diff options
| author | Glenn Morris | 2012-11-19 19:57:23 -0500 |
|---|---|---|
| committer | Glenn Morris | 2012-11-19 19:57:23 -0500 |
| commit | b0636be7f9526041aeaa9f4fb6d3636426eec899 (patch) | |
| tree | 0571fca37a2d91bba1bf9465b2b5306a55135a7d | |
| parent | 8ea5c4de2a2a9d71b3877974c92def925fb26f5d (diff) | |
| download | emacs-b0636be7f9526041aeaa9f4fb6d3636426eec899.tar.gz emacs-b0636be7f9526041aeaa9f4fb6d3636426eec899.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/profiler.el | 54 |
2 files changed, 52 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca585e0669f..8fc9bd409a3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-11-20 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * profiler.el (profiler-report-mode-map): Add a menu. | ||
| 4 | No need to bind `q' because we derive from special-mode. | ||
| 5 | (profiler-report-find-entry): Handle calls from the menu-bar. | ||
| 6 | |||
| 1 | 2012-11-19 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2012-11-19 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * emacs-lisp/byte-run.el (defun-declarations-alist): | 9 | * emacs-lisp/byte-run.el (defun-declarations-alist): |
diff --git a/lisp/profiler.el b/lisp/profiler.el index 38c0c0b83a7..00b51ffe099 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el | |||
| @@ -404,7 +404,6 @@ RET: expand or collapse")) | |||
| 404 | 404 | ||
| 405 | (defvar profiler-report-mode-map | 405 | (defvar profiler-report-mode-map |
| 406 | (let ((map (make-sparse-keymap))) | 406 | (let ((map (make-sparse-keymap))) |
| 407 | ;; FIXME: Add menu. | ||
| 408 | (define-key map "n" 'profiler-report-next-entry) | 407 | (define-key map "n" 'profiler-report-next-entry) |
| 409 | (define-key map "p" 'profiler-report-previous-entry) | 408 | (define-key map "p" 'profiler-report-previous-entry) |
| 410 | ;; I find it annoying more than helpful to not be able to navigate | 409 | ;; I find it annoying more than helpful to not be able to navigate |
| @@ -424,8 +423,43 @@ RET: expand or collapse")) | |||
| 424 | (define-key map "D" 'profiler-report-descending-sort) | 423 | (define-key map "D" 'profiler-report-descending-sort) |
| 425 | (define-key map "=" 'profiler-report-compare-profile) | 424 | (define-key map "=" 'profiler-report-compare-profile) |
| 426 | (define-key map (kbd "C-x C-w") 'profiler-report-write-profile) | 425 | (define-key map (kbd "C-x C-w") 'profiler-report-write-profile) |
| 427 | (define-key map "q" 'quit-window) | 426 | (easy-menu-define profiler-report-menu map "Menu for Profiler Report mode." |
| 428 | map)) | 427 | '("Profiler" |
| 428 | ["Next Entry" profiler-report-next-entry :active t | ||
| 429 | :help "Move to next entry"] | ||
| 430 | ["Previous Entry" profiler-report-previous-entry :active t | ||
| 431 | :help "Move to previous entry"] | ||
| 432 | "--" | ||
| 433 | ["Toggle Entry" profiler-report-toggle-entry | ||
| 434 | :active (profiler-report-calltree-at-point) | ||
| 435 | :help "Expand or collapse the current entry"] | ||
| 436 | ["Find Entry" profiler-report-find-entry | ||
| 437 | ;; FIXME should deactivate if not on a known function. | ||
| 438 | :active (profiler-report-calltree-at-point) | ||
| 439 | :help "Find the definition of the current entry"] | ||
| 440 | ["Describe Entry" profiler-report-describe-entry | ||
| 441 | :active (profiler-report-calltree-at-point) | ||
| 442 | :help "Show the documentation of the current entry"] | ||
| 443 | "--" | ||
| 444 | ["Show Calltree" profiler-report-render-calltree | ||
| 445 | :active profiler-report-reversed | ||
| 446 | :help "Show calltree view"] | ||
| 447 | ["Show Reversed Calltree" profiler-report-render-reversed-calltree | ||
| 448 | :active (not profiler-report-reversed) | ||
| 449 | :help "Show reversed calltree view"] | ||
| 450 | ["Sort Ascending" profiler-report-ascending-sort | ||
| 451 | :active (not (eq profiler-report-order 'ascending)) | ||
| 452 | :help "Sort calltree view in ascending order"] | ||
| 453 | ["Sort Descending" profiler-report-descending-sort | ||
| 454 | :active (not (eq profiler-report-order 'descending)) | ||
| 455 | :help "Sort calltree view in descending order"] | ||
| 456 | "--" | ||
| 457 | ["Compare Profile..." profiler-report-compare-profile :active t | ||
| 458 | :help "Compare current profile with another"] | ||
| 459 | ["Write Profile..." profiler-report-write-profile :active t | ||
| 460 | :help "Write current profile to a file"])) | ||
| 461 | map) | ||
| 462 | "Keymap for `profiler-report-mode'.") | ||
| 429 | 463 | ||
| 430 | (defun profiler-report-make-buffer-name (profile) | 464 | (defun profiler-report-make-buffer-name (profile) |
| 431 | (format "*%s-Profiler-Report %s*" | 465 | (format "*%s-Profiler-Report %s*" |
| @@ -529,11 +563,15 @@ otherwise collapse." | |||
| 529 | (defun profiler-report-find-entry (&optional event) | 563 | (defun profiler-report-find-entry (&optional event) |
| 530 | "Find entry at point." | 564 | "Find entry at point." |
| 531 | (interactive (list last-nonmenu-event)) | 565 | (interactive (list last-nonmenu-event)) |
| 532 | (if event (posn-set-point (event-end event))) | 566 | (with-current-buffer |
| 533 | (let ((tree (profiler-report-calltree-at-point))) | 567 | (if event (window-buffer (posn-window (event-start event))) |
| 534 | (when tree | 568 | (current-buffer)) |
| 535 | (let ((entry (profiler-calltree-entry tree))) | 569 | (and event (setq event (event-end event)) |
| 536 | (find-function entry))))) | 570 | (posn-set-point event)) |
| 571 | (let ((tree (profiler-report-calltree-at-point))) | ||
| 572 | (when tree | ||
| 573 | (let ((entry (profiler-calltree-entry tree))) | ||
| 574 | (find-function entry)))))) | ||
| 537 | 575 | ||
| 538 | (defun profiler-report-describe-entry () | 576 | (defun profiler-report-describe-entry () |
| 539 | "Describe entry at point." | 577 | "Describe entry at point." |