emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110954: Add a menu for profiler repo


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110954: Add a menu for profiler report mode
Date: Mon, 19 Nov 2012 19:57:23 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110954
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Mon 2012-11-19 19:57:23 -0500
message:
  Add a menu for profiler report mode
  
  * lisp/profiler.el (profiler-report-mode-map): Add a menu.
  No need to bind `q' because we derive from special-mode.
  (profiler-report-find-entry): Handle calls from the menu-bar.
modified:
  lisp/ChangeLog
  lisp/profiler.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-11-19 21:30:55 +0000
+++ b/lisp/ChangeLog    2012-11-20 00:57:23 +0000
@@ -1,3 +1,9 @@
+2012-11-20  Glenn Morris  <address@hidden>
+
+       * profiler.el (profiler-report-mode-map): Add a menu.
+       No need to bind `q' because we derive from special-mode.
+       (profiler-report-find-entry): Handle calls from the menu-bar.
+
 2012-11-19  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/byte-run.el (defun-declarations-alist):

=== modified file 'lisp/profiler.el'
--- a/lisp/profiler.el  2012-10-27 09:54:04 +0000
+++ b/lisp/profiler.el  2012-11-20 00:57:23 +0000
@@ -404,7 +404,6 @@
 
 (defvar profiler-report-mode-map
   (let ((map (make-sparse-keymap)))
-    ;; FIXME: Add menu.
     (define-key map "n"            'profiler-report-next-entry)
     (define-key map "p"            'profiler-report-previous-entry)
     ;; I find it annoying more than helpful to not be able to navigate
@@ -424,8 +423,43 @@
     (define-key map "D"            'profiler-report-descending-sort)
     (define-key map "="            'profiler-report-compare-profile)
     (define-key map (kbd "C-x C-w") 'profiler-report-write-profile)
-    (define-key map "q"     'quit-window)
-    map))
+    (easy-menu-define  profiler-report-menu map "Menu for Profiler Report 
mode."
+      '("Profiler"
+        ["Next Entry" profiler-report-next-entry :active t
+         :help "Move to next entry"]
+        ["Previous Entry" profiler-report-previous-entry :active t
+         :help "Move to previous entry"]
+        "--"
+        ["Toggle Entry" profiler-report-toggle-entry
+         :active (profiler-report-calltree-at-point)
+         :help "Expand or collapse the current entry"]
+        ["Find Entry" profiler-report-find-entry
+         ;; FIXME should deactivate if not on a known function.
+         :active (profiler-report-calltree-at-point)
+         :help "Find the definition of the current entry"]
+        ["Describe Entry" profiler-report-describe-entry
+         :active (profiler-report-calltree-at-point)
+         :help "Show the documentation of the current entry"]
+        "--"
+        ["Show Calltree" profiler-report-render-calltree
+         :active profiler-report-reversed
+         :help "Show calltree view"]
+        ["Show Reversed Calltree" profiler-report-render-reversed-calltree
+         :active (not profiler-report-reversed)
+         :help "Show reversed calltree view"]
+        ["Sort Ascending" profiler-report-ascending-sort
+         :active (not (eq profiler-report-order 'ascending))
+         :help "Sort calltree view in ascending order"]
+        ["Sort Descending" profiler-report-descending-sort
+         :active (not (eq profiler-report-order 'descending))
+         :help "Sort calltree view in descending order"]
+        "--"
+        ["Compare Profile..." profiler-report-compare-profile :active t
+         :help "Compare current profile with another"]
+        ["Write Profile..." profiler-report-write-profile :active t
+         :help "Write current profile to a file"]))
+      map)
+  "Keymap for `profiler-report-mode'.")
 
 (defun profiler-report-make-buffer-name (profile)
   (format "*%s-Profiler-Report %s*"
@@ -529,11 +563,15 @@
 (defun profiler-report-find-entry (&optional event)
   "Find entry at point."
   (interactive (list last-nonmenu-event))
-  (if event (posn-set-point (event-end event)))
-  (let ((tree (profiler-report-calltree-at-point)))
-    (when tree
-      (let ((entry (profiler-calltree-entry tree)))
-       (find-function entry)))))
+  (with-current-buffer
+      (if event (window-buffer (posn-window (event-start event)))
+        (current-buffer))
+    (and event (setq event (event-end event))
+         (posn-set-point event))
+    (let ((tree (profiler-report-calltree-at-point)))
+      (when tree
+        (let ((entry (profiler-calltree-entry tree)))
+          (find-function entry))))))
 
 (defun profiler-report-describe-entry ()
   "Describe entry at point."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]