Permalink
Browse files

* 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.
  • Loading branch information...
stassats committed Aug 9, 2009
1 parent 2e66b9e commit 3b683927fc2da1bd036e14f299b218051923f2f8
Showing with 51 additions and 5 deletions.
  1. +7 −0 ChangeLog
  2. +6 −0 contrib/ChangeLog
  3. +6 −4 contrib/slime-fuzzy.el
  4. +2 −0 doc/slime.texi
  5. +12 −1 slime.el
  6. +18 −0 swank.lisp
View
@@ -1,3 +1,10 @@
+2009-08-09 Stas Boukarev <stassats@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@freebits.de>
M-n / M-p in a .lisp buffer now also jump to the respective note
View
@@ -1,3 +1,9 @@
+2009-08-09 Stas Boukarev <stassats@gmail.com>
+
+ * slime-fuzzy.el (slime-fuzzy-complete-symbol): change
+ `comint-completion-addsuffix' to not add space after completing
+ a filename.
+
2009-08-05 Stas Boukarev <stassats@gmail.com>
* swank-fancy-inspector.lisp (emacs-inspect): add buttons for removing
View
@@ -258,10 +258,12 @@ most recently enclosed macro or function."
"Fuzzily completes the abbreviation at point into a symbol."
(interactive)
(when (save-excursion (re-search-backward "\"[^ \t\n]+\\=" nil t))
- (return-from slime-fuzzy-complete-symbol
- (if slime-when-complete-filename-expand
- (comint-replace-by-expanded-filename)
- (comint-dynamic-complete-as-filename))))
+ (return-from slime-fuzzy-complete-symbol
+ ;; don't add space after completion
+ (let ((comint-completion-addsuffix '("/" . "")))
+ (if slime-when-complete-filename-expand
+ (comint-replace-by-expanded-filename)
+ (comint-dynamic-complete-as-filename)))))
(let* ((end (move-marker (make-marker) (slime-symbol-end-pos)))
(beg (move-marker (make-marker) (slime-symbol-start-pos)))
(prefix (buffer-substring-no-properties beg end)))
View
@@ -1252,6 +1252,8 @@ output buffer.
Toggle profiling of a function.
@cmditem{slime-profile-package}
Profile all functions in a package.
+@cmditem{slime-profile-by-substring}
+Profile all functions which names contain a substring.
@cmditem{slime-unprofile-all}
Unprofile all functions.
@cmditem{slime-profile-report}
View
@@ -4611,7 +4611,17 @@ having names in the given package."
(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 @@ is setup, unless the user already set one explicitly."
("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 ]
"--"
View
@@ -3186,6 +3186,24 @@ Include the nicknames if NICKNAMES is true."
(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

0 comments on commit 3b68392

Please sign in to comment.