changeset 56711:eee6cc3fe45e

(elp-results-symname-map): New keymap. (elp-results-jump-to-definition-by-mouse) (elp-results-jump-to-definition, elp-output-insert-symname): New Functions. (elp-output-result): Use elp-output-insert-symname.
author Masatake YAMATO <jet@gyve.org>
date Thu, 19 Aug 2004 07:52:01 +0000
parents e6d92cac8e9b
children 156b4e2a6307
files lisp/ChangeLog lisp/emacs-lisp/elp.el
diffstat 2 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Aug 18 12:22:41 2004 +0000
+++ b/lisp/ChangeLog	Thu Aug 19 07:52:01 2004 +0000
@@ -1,3 +1,10 @@
+2004-08-19  Masatake YAMATO  <jet@gyve.org>
+
+	* emacs-lisp/elp.el (elp-results-symname-map): New keymap.
+	(elp-results-jump-to-definition-by-mouse)
+	(elp-results-jump-to-definition, elp-output-insert-symname): New Functions.
+	(elp-output-result): Use elp-output-insert-symname.
+
 2004-08-17  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* emacs-lisp/copyright.el (copyright-update-year): Delete code
--- a/lisp/emacs-lisp/elp.el	Wed Aug 18 12:22:41 2004 +0000
+++ b/lisp/emacs-lisp/elp.el	Thu Aug 19 07:52:01 2004 +0000
@@ -513,7 +513,7 @@
 	     (numberp elp-report-limit)
 	     (< cc elp-report-limit))
 	nil
-      (insert symname)
+      (elp-output-insert-symname symname)
       (insert-char 32 (+ elp-field-len (- (length symname)) 2))
       ;; print stuff out, formatting it nicely
       (insert callcnt)
@@ -525,6 +525,32 @@
 	(insert atstr))
       (insert "\n"))))
 
+(defvar elp-results-symname-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [mouse-2] 'elp-results-jump-to-definition-by-mouse)
+    (define-key map "\C-m" 'elp-results-jump-to-definition)
+    map)
+  "Keymap used on the function name column." )
+
+(defun elp-results-jump-to-definition-by-mouse (event)
+  "Jump to the definition of the function under the place specified by EVENT."
+  (interactive "e")
+  (posn-set-point (event-end event))
+  (elp-results-jump-to-definition))
+
+(defun elp-results-jump-to-definition ()
+  "Jump to the definition of the function under the point."
+  (interactive)
+  (find-function (get-text-property (point) 'elp-symname)))
+
+(defun elp-output-insert-symname (symname)
+  ;; Insert SYMNAME with text properties.
+  (insert (propertize symname
+		      'elp-symname (intern symname)
+		      'keymap elp-results-symname-map
+		      'mouse-face 'highlight
+		      'help-echo (substitute-command-keys "\\{elp-results-symname-map}"))))
+
 ;;;###autoload
 (defun elp-results ()
   "Display current profiling results.