[slime-cvs] CVS slime

CVS User sboukarev sboukarev at common-lisp.net
Sun Aug 9 14:07:47 UTC 2009


Update of /project/slime/cvsroot/slime
In directory cl-net:/tmp/cvs-serv18771

Modified Files:
	ChangeLog slime.el swank.lisp 
Log Message:
* slime.el (slime-profile-by-substring): new function for profiling
functions by matching a substring.

* swank.lisp (profile-by-substring): ditto.

* contrib/slime-fuzzy.el (slime-fuzzy-complete-symbol): change
`comint-completion-addsuffix' to not add space after completing
a filename.


--- /project/slime/cvsroot/slime/ChangeLog	2009/08/08 21:45:11	1.1824
+++ /project/slime/cvsroot/slime/ChangeLog	2009/08/09 14:07:47	1.1825
@@ -1,3 +1,10 @@
+2009-08-09  Stas Boukarev  <stassats at gmail.com>
+
+	* slime.el (slime-profile-by-substring): new function for profiling
+	functions by matching a substring.
+
+	* swank.lisp (profile-by-substring): ditto.
+
 2009-08-08  Tobias C. Rittweiler  <tcr at freebits.de>
 
 	M-n / M-p in a .lisp buffer now also jump to the respective note
--- /project/slime/cvsroot/slime/slime.el	2009/08/08 21:45:11	1.1204
+++ /project/slime/cvsroot/slime/slime.el	2009/08/09 14:07:47	1.1205
@@ -4611,7 +4611,17 @@
   (slime-eval-async `(swank:profile-package ,package ,callers ,methods)
                     (lambda (r) (message "%s" r))))
 
-
+(defun slime-profile-by-substring (substring &optional package)
+  "Profile all functions which names contain SUBSTRING.
+If PACKAGE is NIL, then search in all packages."
+  (interactive (list
+                (slime-read-from-minibuffer 
+                 "Profile by matching substring: "
+                 (slime-symbol-at-point))
+                (slime-read-package-name "Package (RET for all packages): ")))
+  (let ((package (unless (equal package "") package)))
+    (slime-eval-async `(swank:profile-by-substring ,substring ,package)
+                      (lambda (r) (message "%s" r)) )))
 
 ;;;; Documentation
 
@@ -6887,6 +6897,7 @@
       ("Profiling"
        [ "Toggle Profiling..."     slime-toggle-profile-fdefinition ,C ]
        [ "Profile Package"         slime-profile-package ,C]
+       [ "Profile by Substring"    slime-profile-by-substring ,C ]
        [ "Unprofile All"           slime-unprofile-all ,C ]
        [ "Show Profiled"           slime-profiled-functions ,C ]
        "--"
--- /project/slime/cvsroot/slime/swank.lisp	2009/07/06 11:22:47	1.655
+++ /project/slime/cvsroot/slime/swank.lisp	2009/08/09 14:07:47	1.656
@@ -3186,6 +3186,24 @@
            (profile fname)
 	   (format nil "~S is now profiled." fname)))))
 
+(defslimefun profile-by-substring (substring package)
+  (let ((count 0))
+    (flet ((maybe-profile (symbol)
+             (when (and (fboundp symbol)
+                        (not (profiledp symbol))
+                        (search substring (symbol-name symbol) :test #'equalp))
+               (handler-case (progn
+                               (profile symbol)
+                               (incf count))
+                 (error (condition)
+                   (warn "~a" condition))))))
+      (if package
+          (do-symbols (symbol (parse-package package))
+            (maybe-profile symbol))
+          (do-all-symbols (symbol)
+            (maybe-profile symbol))))
+    (format nil "~a function~:p ~:*~[are~;is~:;are~] now profiled" count)))
+
 
 ;;;; Source Locations
 





More information about the slime-cvs mailing list