aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2022-11-02 15:43:35 +0100
committerStefan Kangas2022-11-03 14:29:11 +0100
commitd8bef573d6451d02a996d556dcd33b8e978b23d7 (patch)
treeda5a41a5a6e3bc0494d61a6636becb3dde3f3b72
parent2eb2eb0c9ead205935be58ce9bb54465d48b20c8 (diff)
downloademacs-d8bef573d6451d02a996d556dcd33b8e978b23d7.tar.gz
emacs-d8bef573d6451d02a996d556dcd33b8e978b23d7.zip
Prefer defvar-keymap in profiler.el
* lisp/profiler.el (profiler-report-mode-map): Prefer defvar-keymap.
-rw-r--r--lisp/profiler.el131
1 files changed, 65 insertions, 66 deletions
diff --git a/lisp/profiler.el b/lisp/profiler.el
index 8670e5786a4..e66b1ff42ad 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -534,72 +534,71 @@ RET: expand or collapse"))
534 534
535;;; Report mode 535;;; Report mode
536 536
537(defvar profiler-report-mode-map 537(defvar-keymap profiler-report-mode-map
538 (let ((map (make-sparse-keymap))) 538 :doc "Keymap for `profiler-report-mode'."
539 (define-key map "n" 'profiler-report-next-entry) 539 "n" #'profiler-report-next-entry
540 (define-key map "p" 'profiler-report-previous-entry) 540 "p" #'profiler-report-previous-entry
541 ;; I find it annoying more than helpful to not be able to navigate 541 ;; I find it annoying more than helpful to not be able to navigate
542 ;; normally with the cursor keys. --Stef 542 ;; normally with the cursor keys. --Stef
543 ;; (define-key map [down] 'profiler-report-next-entry) 543 ;; "<down>" #'profiler-report-next-entry
544 ;; (define-key map [up] 'profiler-report-previous-entry) 544 ;; "<up>" #'profiler-report-previous-entry
545 (define-key map "\r" 'profiler-report-toggle-entry) 545 "RET" #'profiler-report-toggle-entry
546 (define-key map "\t" 'profiler-report-toggle-entry) 546 "TAB" #'profiler-report-toggle-entry
547 (define-key map "i" 'profiler-report-toggle-entry) 547 "i" #'profiler-report-toggle-entry
548 (define-key map "f" 'profiler-report-find-entry) 548 "f" #'profiler-report-find-entry
549 (define-key map "j" 'profiler-report-find-entry) 549 "j" #'profiler-report-find-entry
550 (define-key map [follow-link] 'mouse-face) 550 "d" #'profiler-report-describe-entry
551 (define-key map [mouse-2] 'profiler-report-find-entry) 551 "C" #'profiler-report-render-calltree
552 (define-key map "d" 'profiler-report-describe-entry) 552 "B" #'profiler-report-render-reversed-calltree
553 (define-key map "C" 'profiler-report-render-calltree) 553 "A" #'profiler-report-ascending-sort
554 (define-key map "B" 'profiler-report-render-reversed-calltree) 554 "D" #'profiler-report-descending-sort
555 (define-key map "A" 'profiler-report-ascending-sort) 555 "=" #'profiler-report-compare-profile
556 (define-key map "D" 'profiler-report-descending-sort) 556 "C-x C-w" #'profiler-report-write-profile
557 (define-key map "=" 'profiler-report-compare-profile) 557 "<follow-link>" 'mouse-face
558 (define-key map (kbd "C-x C-w") 'profiler-report-write-profile) 558 "<mouse-2>" #'profiler-report-find-entry
559 (easy-menu-define profiler-report-menu map "Menu for Profiler Report mode." 559
560 '("Profiler" 560 :menu
561 ["Next Entry" profiler-report-next-entry :active t 561 '("Profiler"
562 :help "Move to next entry"] 562 ["Next Entry" profiler-report-next-entry :active t
563 ["Previous Entry" profiler-report-previous-entry :active t 563 :help "Move to next entry"]
564 :help "Move to previous entry"] 564 ["Previous Entry" profiler-report-previous-entry :active t
565 "--" 565 :help "Move to previous entry"]
566 ["Toggle Entry" profiler-report-toggle-entry 566 "--"
567 :active (profiler-report-calltree-at-point) 567 ["Toggle Entry" profiler-report-toggle-entry
568 :help "Expand or collapse the current entry"] 568 :active (profiler-report-calltree-at-point)
569 ["Find Entry" profiler-report-find-entry 569 :help "Expand or collapse the current entry"]
570 ;; FIXME should deactivate if not on a known function. 570 ["Find Entry" profiler-report-find-entry
571 :active (profiler-report-calltree-at-point) 571 ;; FIXME should deactivate if not on a known function.
572 :help "Find the definition of the current entry"] 572 :active (profiler-report-calltree-at-point)
573 ["Describe Entry" profiler-report-describe-entry 573 :help "Find the definition of the current entry"]
574 :active (profiler-report-calltree-at-point) 574 ["Describe Entry" profiler-report-describe-entry
575 :help "Show the documentation of the current entry"] 575 :active (profiler-report-calltree-at-point)
576 "--" 576 :help "Show the documentation of the current entry"]
577 ["Show Calltree" profiler-report-render-calltree 577 "--"
578 :active profiler-report-reversed 578 ["Show Calltree" profiler-report-render-calltree
579 :help "Show calltree view"] 579 :active profiler-report-reversed
580 ["Show Reversed Calltree" profiler-report-render-reversed-calltree 580 :help "Show calltree view"]
581 :active (not profiler-report-reversed) 581 ["Show Reversed Calltree" profiler-report-render-reversed-calltree
582 :help "Show reversed calltree view"] 582 :active (not profiler-report-reversed)
583 ["Sort Ascending" profiler-report-ascending-sort 583 :help "Show reversed calltree view"]
584 :active (not (eq profiler-report-order 'ascending)) 584 ["Sort Ascending" profiler-report-ascending-sort
585 :help "Sort calltree view in ascending order"] 585 :active (not (eq profiler-report-order 'ascending))
586 ["Sort Descending" profiler-report-descending-sort 586 :help "Sort calltree view in ascending order"]
587 :active (not (eq profiler-report-order 'descending)) 587 ["Sort Descending" profiler-report-descending-sort
588 :help "Sort calltree view in descending order"] 588 :active (not (eq profiler-report-order 'descending))
589 "--" 589 :help "Sort calltree view in descending order"]
590 ["Compare Profile..." profiler-report-compare-profile :active t 590 "--"
591 :help "Compare current profile with another"] 591 ["Compare Profile..." profiler-report-compare-profile :active t
592 ["Write Profile..." profiler-report-write-profile :active t 592 :help "Compare current profile with another"]
593 :help "Write current profile to a file"] 593 ["Write Profile..." profiler-report-write-profile :active t
594 "--" 594 :help "Write current profile to a file"]
595 ["Start Profiler" profiler-start :active (not (profiler-running-p)) 595 "--"
596 :help "Start profiling"] 596 ["Start Profiler" profiler-start :active (not (profiler-running-p))
597 ["Stop Profiler" profiler-stop :active (profiler-running-p) 597 :help "Start profiling"]
598 :help "Stop profiling"] 598 ["Stop Profiler" profiler-stop :active (profiler-running-p)
599 ["New Report" profiler-report :active (profiler-running-p) 599 :help "Stop profiling"]
600 :help "Make a new report"])) 600 ["New Report" profiler-report :active (profiler-running-p)
601 map) 601 :help "Make a new report"]))
602 "Keymap for `profiler-report-mode'.")
603 602
604(defun profiler-report-make-buffer-name (profile) 603(defun profiler-report-make-buffer-name (profile)
605 (format "*%s-Profiler-Report %s*" 604 (format "*%s-Profiler-Report %s*"