diff options
| author | Stefan Monnier | 2024-03-21 19:40:20 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2024-03-21 19:40:20 -0400 |
| commit | a1f8702e8345254e6898d35e554bdc06ab09c3ca (patch) | |
| tree | 1f8f71d5900b218a9236f350ee5c15903bd6196c | |
| parent | 946280365d40104dffd5329eebefc02329f72041 (diff) | |
| download | emacs-a1f8702e8345254e6898d35e554bdc06ab09c3ca.tar.gz emacs-a1f8702e8345254e6898d35e554bdc06ab09c3ca.zip | |
(help-fns-function-name): New function
Consolidate code used in profiler and help--describe-command,
and improve it while we're at it.
Also use #' to quote a few function names along the way.
* lisp/help-fns.el (help-fns--function-numbers, help-fns--function-names):
New vars.
(help-fns--display-function): New aux function.
(help-fns-function-name): New function, inspired from
`help--describe-command`.
* lisp/help.el (help--describe-command): Use `help-fns-function-name`.
(help--for-help-make-sections): Remove redundant "" arg to `mapconcat`.
* lisp/profiler.el (profiler-format-entry, profiler-fixup-entry):
Delete functions.
(profiler-report-make-entry-part): Use `help-fns-function-name` instead.
(profiler-report-find-entry): Use `push-button`.
* lisp/transient.el (transient--debug): Use `help-fns-function-name`
when available.
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/bind-key.el | 1 | ||||
| -rw-r--r-- | lisp/help-fns.el | 68 | ||||
| -rw-r--r-- | lisp/help.el | 44 | ||||
| -rw-r--r-- | lisp/profiler.el | 74 | ||||
| -rw-r--r-- | lisp/transient.el | 22 |
6 files changed, 127 insertions, 88 deletions
| @@ -1647,6 +1647,12 @@ values. | |||
| 1647 | 1647 | ||
| 1648 | * Lisp Changes in Emacs 30.1 | 1648 | * Lisp Changes in Emacs 30.1 |
| 1649 | 1649 | ||
| 1650 | ** New function 'help-fns-function-name'. | ||
| 1651 | For named functions, it just returns the name and otherwise | ||
| 1652 | it returns a short "unique" string that identifies the function. | ||
| 1653 | In either case, the string is propertized so clicking on it gives | ||
| 1654 | further details. | ||
| 1655 | |||
| 1650 | ** New function 'cl-type-of'. | 1656 | ** New function 'cl-type-of'. |
| 1651 | This function is like 'type-of' except that it sometimes returns | 1657 | This function is like 'type-of' except that it sometimes returns |
| 1652 | a more precise type. For example, for nil and t it returns 'null' | 1658 | a more precise type. For example, for nil and t it returns 'null' |
diff --git a/lisp/bind-key.el b/lisp/bind-key.el index 1e59c75566a..780314fecbd 100644 --- a/lisp/bind-key.el +++ b/lisp/bind-key.el | |||
| @@ -468,6 +468,7 @@ other modes. See `override-global-mode'." | |||
| 468 | ((and bind-key-describe-special-forms (functionp elem) | 468 | ((and bind-key-describe-special-forms (functionp elem) |
| 469 | (stringp (setq doc (documentation elem)))) | 469 | (stringp (setq doc (documentation elem)))) |
| 470 | doc) ;;FIXME: Keep only the first line? | 470 | doc) ;;FIXME: Keep only the first line? |
| 471 | ;; FIXME: Use `help-fns-function-name'? | ||
| 471 | ((consp elem) | 472 | ((consp elem) |
| 472 | (if (symbolp (car elem)) | 473 | (if (symbolp (car elem)) |
| 473 | (format "#<%s>" (car elem)) | 474 | (format "#<%s>" (car elem)) |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 15d87f9925c..422f6e9dddf 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -2448,6 +2448,74 @@ one of them returns non-nil." | |||
| 2448 | (setq buffer-undo-list nil) | 2448 | (setq buffer-undo-list nil) |
| 2449 | (texinfo-mode))) | 2449 | (texinfo-mode))) |
| 2450 | 2450 | ||
| 2451 | (defconst help-fns--function-numbers | ||
| 2452 | (make-hash-table :test 'equal :weakness 'value)) | ||
| 2453 | (defconst help-fns--function-names (make-hash-table :weakness 'key)) | ||
| 2454 | |||
| 2455 | (defun help-fns--display-function (function) | ||
| 2456 | (cond | ||
| 2457 | ((subr-primitive-p function) | ||
| 2458 | (describe-function function)) | ||
| 2459 | ((and (compiled-function-p function) | ||
| 2460 | (not (and (fboundp 'kmacro-p) (kmacro-p function)))) | ||
| 2461 | (disassemble function)) | ||
| 2462 | (t | ||
| 2463 | ;; FIXME: Use cl-print! | ||
| 2464 | (pp-display-expression function "*Help Source*" (consp function))))) | ||
| 2465 | |||
| 2466 | ;;;###autoload | ||
| 2467 | (defun help-fns-function-name (function) | ||
| 2468 | "Return a short string representing FUNCTION." | ||
| 2469 | ;; FIXME: For kmacros, should we print the key-sequence? | ||
| 2470 | (cond | ||
| 2471 | ((symbolp function) | ||
| 2472 | (let ((name (if (eq (intern-soft (symbol-name function)) function) | ||
| 2473 | (symbol-name function) | ||
| 2474 | (concat "#:" (symbol-name function))))) | ||
| 2475 | (if (not (fboundp function)) | ||
| 2476 | name | ||
| 2477 | (make-text-button name nil | ||
| 2478 | 'type 'help-function | ||
| 2479 | 'help-args (list function))))) | ||
| 2480 | ((gethash function help-fns--function-names)) | ||
| 2481 | ((subrp function) | ||
| 2482 | (let ((name (subr-name function))) | ||
| 2483 | ;; FIXME: For native-elisp-functions, should we use `help-function' | ||
| 2484 | ;; or `disassemble'? | ||
| 2485 | (format "#<%s %s>" | ||
| 2486 | (cl-type-of function) | ||
| 2487 | (make-text-button name nil | ||
| 2488 | 'type 'help-function | ||
| 2489 | ;; Let's hope the subr hasn't been redefined! | ||
| 2490 | 'help-args (list (intern name)))))) | ||
| 2491 | (t | ||
| 2492 | (let ((type (or (oclosure-type function) | ||
| 2493 | (if (consp function) | ||
| 2494 | (car function) (cl-type-of function)))) | ||
| 2495 | (hash (sxhash-eq function)) | ||
| 2496 | ;; Use 3 digits minimum. | ||
| 2497 | (mask #xfff) | ||
| 2498 | name) | ||
| 2499 | (while | ||
| 2500 | (let* ((hex (format (concat "%0" | ||
| 2501 | (number-to-string (1+ (/ (logb mask) 4))) | ||
| 2502 | "X") | ||
| 2503 | (logand mask hash))) | ||
| 2504 | ;; FIXME: For kmacros, we don't want to `disassemble'! | ||
| 2505 | (button (buttonize | ||
| 2506 | hex #'help-fns--display-function function | ||
| 2507 | ;; FIXME: Shouldn't `buttonize' add | ||
| 2508 | ;; the "mouse-2, RET:" prefix? | ||
| 2509 | "mouse-2, RET: Display the function's body"))) | ||
| 2510 | (setq name (format "#<%s %s>" type button)) | ||
| 2511 | (and (< mask (abs hash)) ; We can add more digits. | ||
| 2512 | (gethash name help-fns--function-numbers))) | ||
| 2513 | ;; Add a digit. | ||
| 2514 | (setq mask (+ (ash mask 4) #x0f))) | ||
| 2515 | (puthash name function help-fns--function-numbers) | ||
| 2516 | (puthash function name help-fns--function-names) | ||
| 2517 | name)))) | ||
| 2518 | |||
| 2451 | (provide 'help-fns) | 2519 | (provide 'help-fns) |
| 2452 | 2520 | ||
| 2453 | ;;; help-fns.el ends here | 2521 | ;;; help-fns.el ends here |
diff --git a/lisp/help.el b/lisp/help.el index c6a1e3c6bd9..4171d0c57c7 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -301,6 +301,8 @@ Do not call this in the scope of `with-help-window'." | |||
| 301 | (let ((first-message | 301 | (let ((first-message |
| 302 | (cond ((or | 302 | (cond ((or |
| 303 | pop-up-frames | 303 | pop-up-frames |
| 304 | ;; FIXME: `special-display-p' is obsolete since | ||
| 305 | ;; the vars on which it depends are obsolete! | ||
| 304 | (special-display-p (buffer-name standard-output))) | 306 | (special-display-p (buffer-name standard-output))) |
| 305 | (setq help-return-method (cons (selected-window) t)) | 307 | (setq help-return-method (cons (selected-window) t)) |
| 306 | ;; If the help output buffer is a special display buffer, | 308 | ;; If the help output buffer is a special display buffer, |
| @@ -382,9 +384,9 @@ Do not call this in the scope of `with-help-window'." | |||
| 382 | (propertize title 'face 'help-for-help-header) | 384 | (propertize title 'face 'help-for-help-header) |
| 383 | "\n\n" | 385 | "\n\n" |
| 384 | (help--for-help-make-commands commands)))) | 386 | (help--for-help-make-commands commands)))) |
| 385 | sections "")) | 387 | sections)) |
| 386 | 388 | ||
| 387 | (defalias 'help 'help-for-help) | 389 | (defalias 'help #'help-for-help) |
| 388 | (make-help-screen help-for-help | 390 | (make-help-screen help-for-help |
| 389 | (purecopy "Type a help option: [abcCdefFgiIkKlLmnprstvw.] C-[cdefmnoptw] or ?") | 391 | (purecopy "Type a help option: [abcCdefFgiIkKlLmnprstvw.] C-[cdefmnoptw] or ?") |
| 390 | (concat | 392 | (concat |
| @@ -876,7 +878,7 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer." | |||
| 876 | (format "%s (translated from %s)" string otherstring)))))) | 878 | (format "%s (translated from %s)" string otherstring)))))) |
| 877 | 879 | ||
| 878 | (defun help--binding-undefined-p (defn) | 880 | (defun help--binding-undefined-p (defn) |
| 879 | (or (null defn) (integerp defn) (equal defn 'undefined))) | 881 | (or (null defn) (integerp defn) (equal defn #'undefined))) |
| 880 | 882 | ||
| 881 | (defun help--analyze-key (key untranslated &optional buffer) | 883 | (defun help--analyze-key (key untranslated &optional buffer) |
| 882 | "Get information about KEY its corresponding UNTRANSLATED events. | 884 | "Get information about KEY its corresponding UNTRANSLATED events. |
| @@ -1221,7 +1223,7 @@ appeared on the mode-line." | |||
| 1221 | (defun describe-minor-mode-completion-table-for-symbol () | 1223 | (defun describe-minor-mode-completion-table-for-symbol () |
| 1222 | ;; In order to list up all minor modes, minor-mode-list | 1224 | ;; In order to list up all minor modes, minor-mode-list |
| 1223 | ;; is used here instead of minor-mode-alist. | 1225 | ;; is used here instead of minor-mode-alist. |
| 1224 | (delq nil (mapcar 'symbol-name minor-mode-list))) | 1226 | (delq nil (mapcar #'symbol-name minor-mode-list))) |
| 1225 | 1227 | ||
| 1226 | (defun describe-minor-mode-from-symbol (symbol) | 1228 | (defun describe-minor-mode-from-symbol (symbol) |
| 1227 | "Display documentation of a minor mode given as a symbol, SYMBOL." | 1229 | "Display documentation of a minor mode given as a symbol, SYMBOL." |
| @@ -1644,34 +1646,14 @@ Return nil if the key sequence is too long." | |||
| 1644 | (t value)))) | 1646 | (t value)))) |
| 1645 | 1647 | ||
| 1646 | (defun help--describe-command (definition &optional translation) | 1648 | (defun help--describe-command (definition &optional translation) |
| 1647 | (cond ((symbolp definition) | 1649 | (cond ((or (stringp definition) (vectorp definition)) |
| 1648 | (if (and (fboundp definition) | ||
| 1649 | help-buffer-under-preparation) | ||
| 1650 | (insert-text-button (symbol-name definition) | ||
| 1651 | 'type 'help-function | ||
| 1652 | 'help-args (list definition)) | ||
| 1653 | (insert (symbol-name definition))) | ||
| 1654 | (insert "\n")) | ||
| 1655 | ((or (stringp definition) (vectorp definition)) | ||
| 1656 | (if translation | 1650 | (if translation |
| 1657 | (insert (key-description definition nil) "\n") | 1651 | (insert (key-description definition nil) "\n") |
| 1652 | ;; These should be rare nowadays, replaced by `kmacro's. | ||
| 1658 | (insert "Keyboard Macro\n"))) | 1653 | (insert "Keyboard Macro\n"))) |
| 1659 | ((keymapp definition) | 1654 | ((keymapp definition) |
| 1660 | (insert "Prefix Command\n")) | 1655 | (insert "Prefix Command\n")) |
| 1661 | ((byte-code-function-p definition) | 1656 | (t (insert (help-fns-function-name definition) "\n")))) |
| 1662 | (insert (format "[%s]\n" | ||
| 1663 | (buttonize "byte-code" #'disassemble definition)))) | ||
| 1664 | ((and (consp definition) | ||
| 1665 | (memq (car definition) '(closure lambda))) | ||
| 1666 | (insert (format "[%s]\n" | ||
| 1667 | (buttonize | ||
| 1668 | (symbol-name (car definition)) | ||
| 1669 | (lambda (_) | ||
| 1670 | (pp-display-expression | ||
| 1671 | definition "*Help Source*" t)) | ||
| 1672 | nil "View definition")))) | ||
| 1673 | (t | ||
| 1674 | (insert "??\n")))) | ||
| 1675 | 1657 | ||
| 1676 | (define-obsolete-function-alias 'help--describe-translation | 1658 | (define-obsolete-function-alias 'help--describe-translation |
| 1677 | #'help--describe-command "29.1") | 1659 | #'help--describe-command "29.1") |
| @@ -2011,8 +1993,8 @@ and some others." | |||
| 2011 | (if temp-buffer-resize-mode | 1993 | (if temp-buffer-resize-mode |
| 2012 | ;; `help-make-xrefs' may add a `back' button and thus increase the | 1994 | ;; `help-make-xrefs' may add a `back' button and thus increase the |
| 2013 | ;; text size, so `resize-temp-buffer-window' must be run *after* it. | 1995 | ;; text size, so `resize-temp-buffer-window' must be run *after* it. |
| 2014 | (add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append) | 1996 | (add-hook 'temp-buffer-show-hook #'resize-temp-buffer-window 'append) |
| 2015 | (remove-hook 'temp-buffer-show-hook 'resize-temp-buffer-window))) | 1997 | (remove-hook 'temp-buffer-show-hook #'resize-temp-buffer-window))) |
| 2016 | 1998 | ||
| 2017 | (defvar resize-temp-buffer-window-inhibit nil | 1999 | (defvar resize-temp-buffer-window-inhibit nil |
| 2018 | "Non-nil means `resize-temp-buffer-window' should not resize.") | 2000 | "Non-nil means `resize-temp-buffer-window' should not resize.") |
| @@ -2256,7 +2238,7 @@ The `temp-buffer-window-setup-hook' hook is called." | |||
| 2256 | ;; Don't print to *Help*; that would clobber Help history. | 2238 | ;; Don't print to *Help*; that would clobber Help history. |
| 2257 | (defun help-form-show () | 2239 | (defun help-form-show () |
| 2258 | "Display the output of a non-nil `help-form'." | 2240 | "Display the output of a non-nil `help-form'." |
| 2259 | (let ((msg (eval help-form))) | 2241 | (let ((msg (eval help-form t))) |
| 2260 | (if (stringp msg) | 2242 | (if (stringp msg) |
| 2261 | (with-output-to-temp-buffer " *Char Help*" | 2243 | (with-output-to-temp-buffer " *Char Help*" |
| 2262 | (princ msg))))) | 2244 | (princ msg))))) |
| @@ -2421,7 +2403,7 @@ the same names as used in the original source code, when possible." | |||
| 2421 | (t arg))) | 2403 | (t arg))) |
| 2422 | arglist))) | 2404 | arglist))) |
| 2423 | 2405 | ||
| 2424 | (define-obsolete-function-alias 'help-make-usage 'help--make-usage "25.1") | 2406 | (define-obsolete-function-alias 'help-make-usage #'help--make-usage "25.1") |
| 2425 | 2407 | ||
| 2426 | (defun help--make-usage-docstring (fn arglist) | 2408 | (defun help--make-usage-docstring (fn arglist) |
| 2427 | (let ((print-escape-newlines t)) | 2409 | (let ((print-escape-newlines t)) |
diff --git a/lisp/profiler.el b/lisp/profiler.el index 80f84037a63..4e02cd1d890 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el | |||
| @@ -38,8 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | (defcustom profiler-sampling-interval 1000000 | 39 | (defcustom profiler-sampling-interval 1000000 |
| 40 | "Default sampling interval in nanoseconds." | 40 | "Default sampling interval in nanoseconds." |
| 41 | :type 'natnum | 41 | :type 'natnum) |
| 42 | :group 'profiler) | ||
| 43 | 42 | ||
| 44 | 43 | ||
| 45 | ;;; Utilities | 44 | ;;; Utilities |
| @@ -68,7 +67,7 @@ | |||
| 68 | collect c into s | 67 | collect c into s |
| 69 | do (cl-decf i) | 68 | do (cl-decf i) |
| 70 | finally return | 69 | finally return |
| 71 | (apply 'string (if (eq (car s) ?,) (cdr s) s))) | 70 | (apply #'string (if (eq (car s) ?,) (cdr s) s))) |
| 72 | (profiler-ensure-string number))) | 71 | (profiler-ensure-string number))) |
| 73 | 72 | ||
| 74 | (defun profiler-format (fmt &rest args) | 73 | (defun profiler-format (fmt &rest args) |
| @@ -76,7 +75,7 @@ | |||
| 76 | for arg in args | 75 | for arg in args |
| 77 | for str = (cond | 76 | for str = (cond |
| 78 | ((consp subfmt) | 77 | ((consp subfmt) |
| 79 | (apply 'profiler-format subfmt arg)) | 78 | (apply #'profiler-format subfmt arg)) |
| 80 | ((stringp subfmt) | 79 | ((stringp subfmt) |
| 81 | (format subfmt arg)) | 80 | (format subfmt arg)) |
| 82 | ((and (symbolp subfmt) | 81 | ((and (symbolp subfmt) |
| @@ -91,7 +90,8 @@ | |||
| 91 | if (< width len) | 90 | if (< width len) |
| 92 | collect (progn (put-text-property (max 0 (- width 2)) len | 91 | collect (progn (put-text-property (max 0 (- width 2)) len |
| 93 | 'invisible 'profiler str) | 92 | 'invisible 'profiler str) |
| 94 | str) into frags | 93 | str) |
| 94 | into frags | ||
| 95 | else | 95 | else |
| 96 | collect | 96 | collect |
| 97 | (let ((padding (make-string (max 0 (- width len)) ?\s))) | 97 | (let ((padding (make-string (max 0 (- width len)) ?\s))) |
| @@ -100,32 +100,11 @@ | |||
| 100 | (right (concat padding str)))) | 100 | (right (concat padding str)))) |
| 101 | into frags | 101 | into frags |
| 102 | finally return (apply #'concat frags))) | 102 | finally return (apply #'concat frags))) |
| 103 | |||
| 104 | |||
| 105 | ;;; Entries | ||
| 106 | |||
| 107 | (defun profiler-format-entry (entry) | ||
| 108 | "Format ENTRY in human readable string. | ||
| 109 | ENTRY would be a function name of a function itself." | ||
| 110 | (cond ((memq (car-safe entry) '(closure lambda)) | ||
| 111 | (format "#<lambda %#x>" (sxhash entry))) | ||
| 112 | ((byte-code-function-p entry) | ||
| 113 | (format "#<compiled %#x>" (sxhash entry))) | ||
| 114 | ((or (subrp entry) (symbolp entry) (stringp entry)) | ||
| 115 | (format "%s" entry)) | ||
| 116 | (t | ||
| 117 | (format "#<unknown %#x>" (sxhash entry))))) | ||
| 118 | |||
| 119 | (defun profiler-fixup-entry (entry) | ||
| 120 | (if (symbolp entry) | ||
| 121 | entry | ||
| 122 | (profiler-format-entry entry))) | ||
| 123 | |||
| 124 | 103 | ||
| 125 | ;;; Backtraces | 104 | ;;; Backtraces |
| 126 | 105 | ||
| 127 | (defun profiler-fixup-backtrace (backtrace) | 106 | (defun profiler-fixup-backtrace (backtrace) |
| 128 | (apply 'vector (mapcar 'profiler-fixup-entry backtrace))) | 107 | (apply #'vector (mapcar #'help-fns-function-name backtrace))) |
| 129 | 108 | ||
| 130 | 109 | ||
| 131 | ;;; Logs | 110 | ;;; Logs |
| @@ -434,18 +413,15 @@ Optional argument MODE means only check for the specified mode (cpu or mem)." | |||
| 434 | 413 | ||
| 435 | (defcustom profiler-report-closed-mark "+" | 414 | (defcustom profiler-report-closed-mark "+" |
| 436 | "An indicator of closed calltrees." | 415 | "An indicator of closed calltrees." |
| 437 | :type 'string | 416 | :type 'string) |
| 438 | :group 'profiler) | ||
| 439 | 417 | ||
| 440 | (defcustom profiler-report-open-mark "-" | 418 | (defcustom profiler-report-open-mark "-" |
| 441 | "An indicator of open calltrees." | 419 | "An indicator of open calltrees." |
| 442 | :type 'string | 420 | :type 'string) |
| 443 | :group 'profiler) | ||
| 444 | 421 | ||
| 445 | (defcustom profiler-report-leaf-mark " " | 422 | (defcustom profiler-report-leaf-mark " " |
| 446 | "An indicator of calltree leaves." | 423 | "An indicator of calltree leaves." |
| 447 | :type 'string | 424 | :type 'string) |
| 448 | :group 'profiler) | ||
| 449 | 425 | ||
| 450 | (defvar profiler-report-cpu-line-format | 426 | (defvar profiler-report-cpu-line-format |
| 451 | '((17 right ((12 right) | 427 | '((17 right ((12 right) |
| @@ -474,17 +450,18 @@ Do not touch this variable directly.") | |||
| 474 | (let ((string (cond | 450 | (let ((string (cond |
| 475 | ((eq entry t) | 451 | ((eq entry t) |
| 476 | "Others") | 452 | "Others") |
| 477 | ((and (symbolp entry) | 453 | (t (propertize (help-fns-function-name entry) |
| 478 | (fboundp entry)) | 454 | ;; Override the `button-map' which |
| 479 | (propertize (symbol-name entry) | 455 | ;; otherwise adds RET, mouse-1, and TAB |
| 480 | 'face 'link | 456 | ;; bindings we don't want. :-( |
| 481 | 'follow-link "\r" | 457 | 'keymap '(make-sparse-keymap) |
| 482 | 'mouse-face 'highlight | 458 | 'follow-link "\r" |
| 483 | 'help-echo "\ | 459 | ;; FIXME: The help-echo code gets confused |
| 460 | ;; by the `follow-link' property and rewrites | ||
| 461 | ;; `mouse-2' to `mouse-1' :-( | ||
| 462 | 'help-echo "\ | ||
| 484 | mouse-2: jump to definition\n\ | 463 | mouse-2: jump to definition\n\ |
| 485 | RET: expand or collapse")) | 464 | RET: expand or collapse"))))) |
| 486 | (t | ||
| 487 | (profiler-format-entry entry))))) | ||
| 488 | (propertize string 'profiler-entry entry))) | 465 | (propertize string 'profiler-entry entry))) |
| 489 | 466 | ||
| 490 | (defun profiler-report-make-name-part (tree) | 467 | (defun profiler-report-make-name-part (tree) |
| @@ -719,10 +696,13 @@ point." | |||
| 719 | (current-buffer)) | 696 | (current-buffer)) |
| 720 | (and event (setq event (event-end event)) | 697 | (and event (setq event (event-end event)) |
| 721 | (posn-set-point event)) | 698 | (posn-set-point event)) |
| 722 | (let ((tree (profiler-report-calltree-at-point))) | 699 | (save-excursion |
| 723 | (when tree | 700 | (forward-line 0) |
| 724 | (let ((entry (profiler-calltree-entry tree))) | 701 | (let ((eol (pos-eol))) |
| 725 | (find-function entry)))))) | 702 | (forward-button 1) |
| 703 | (if (> (point) eol) | ||
| 704 | (error "No entry found") | ||
| 705 | (push-button)))))) | ||
| 726 | 706 | ||
| 727 | (defun profiler-report-describe-entry () | 707 | (defun profiler-report-describe-entry () |
| 728 | "Describe entry at point." | 708 | "Describe entry at point." |
diff --git a/lisp/transient.el b/lisp/transient.el index 2d8566a3ac4..c3b9448e2c4 100644 --- a/lisp/transient.el +++ b/lisp/transient.el | |||
| @@ -1249,7 +1249,7 @@ symbol property.") | |||
| 1249 | (when (and (boundp 'read-extended-command-predicate) ; since Emacs 28.1 | 1249 | (when (and (boundp 'read-extended-command-predicate) ; since Emacs 28.1 |
| 1250 | (not read-extended-command-predicate)) | 1250 | (not read-extended-command-predicate)) |
| 1251 | (setq read-extended-command-predicate | 1251 | (setq read-extended-command-predicate |
| 1252 | 'transient-command-completion-not-suffix-only-p)) | 1252 | #'transient-command-completion-not-suffix-only-p)) |
| 1253 | 1253 | ||
| 1254 | (defun transient-parse-suffix (prefix suffix) | 1254 | (defun transient-parse-suffix (prefix suffix) |
| 1255 | "Parse SUFFIX, to be added to PREFIX. | 1255 | "Parse SUFFIX, to be added to PREFIX. |
| @@ -1258,7 +1258,7 @@ SUFFIX is a suffix command or a group specification (of | |||
| 1258 | the same forms as expected by `transient-define-prefix'). | 1258 | the same forms as expected by `transient-define-prefix'). |
| 1259 | Intended for use in a group's `:setup-children' function." | 1259 | Intended for use in a group's `:setup-children' function." |
| 1260 | (cl-assert (and prefix (symbolp prefix))) | 1260 | (cl-assert (and prefix (symbolp prefix))) |
| 1261 | (eval (car (transient--parse-child prefix suffix)))) | 1261 | (eval (car (transient--parse-child prefix suffix)) t)) |
| 1262 | 1262 | ||
| 1263 | (defun transient-parse-suffixes (prefix suffixes) | 1263 | (defun transient-parse-suffixes (prefix suffixes) |
| 1264 | "Parse SUFFIXES, to be added to PREFIX. | 1264 | "Parse SUFFIXES, to be added to PREFIX. |
| @@ -1278,7 +1278,7 @@ Intended for use in a group's `:setup-children' function." | |||
| 1278 | (string suffix))) | 1278 | (string suffix))) |
| 1279 | (mem (transient--layout-member loc prefix)) | 1279 | (mem (transient--layout-member loc prefix)) |
| 1280 | (elt (car mem))) | 1280 | (elt (car mem))) |
| 1281 | (setq suf (eval suf)) | 1281 | (setq suf (eval suf t)) |
| 1282 | (cond | 1282 | (cond |
| 1283 | ((not mem) | 1283 | ((not mem) |
| 1284 | (message "Cannot insert %S into %s; %s not found" | 1284 | (message "Cannot insert %S into %s; %s not found" |
| @@ -1736,7 +1736,8 @@ to `transient-predicate-map'. Also see `transient-base-map'." | |||
| 1736 | "Hide common commands" | 1736 | "Hide common commands" |
| 1737 | "Show common permanently"))) | 1737 | "Show common permanently"))) |
| 1738 | (list "C-x l" "Show/hide suffixes" #'transient-set-level) | 1738 | (list "C-x l" "Show/hide suffixes" #'transient-set-level) |
| 1739 | (list "C-x a" #'transient-toggle-level-limit)))))))) | 1739 | (list "C-x a" #'transient-toggle-level-limit))))) |
| 1740 | t))) | ||
| 1740 | 1741 | ||
| 1741 | (defvar-keymap transient-popup-navigation-map | 1742 | (defvar-keymap transient-popup-navigation-map |
| 1742 | :doc "One of the keymaps used when popup navigation is enabled. | 1743 | :doc "One of the keymaps used when popup navigation is enabled. |
| @@ -2574,10 +2575,11 @@ value. Otherwise return CHILDREN as is." | |||
| 2574 | (if (symbolp arg) | 2575 | (if (symbolp arg) |
| 2575 | (message "-- %-22s (cmd: %s, event: %S, exit: %s%s)" | 2576 | (message "-- %-22s (cmd: %s, event: %S, exit: %s%s)" |
| 2576 | arg | 2577 | arg |
| 2577 | (or (and (symbolp this-command) this-command) | 2578 | (if (fboundp 'help-fns-function-name) |
| 2578 | (if (byte-code-function-p this-command) | 2579 | (help-fns-function-name this-command) |
| 2579 | "#[...]" | 2580 | (if (byte-code-function-p this-command) |
| 2580 | this-command)) | 2581 | "#[...]" |
| 2582 | this-command)) | ||
| 2581 | (key-description (this-command-keys-vector)) | 2583 | (key-description (this-command-keys-vector)) |
| 2582 | transient--exitp | 2584 | transient--exitp |
| 2583 | (cond ((keywordp (car args)) | 2585 | (cond ((keywordp (car args)) |
| @@ -2982,7 +2984,7 @@ transient is active." | |||
| 2982 | (interactive) | 2984 | (interactive) |
| 2983 | (transient-set-value (transient-prefix-object))) | 2985 | (transient-set-value (transient-prefix-object))) |
| 2984 | 2986 | ||
| 2985 | (defalias 'transient-set-and-exit 'transient-set | 2987 | (defalias 'transient-set-and-exit #'transient-set |
| 2986 | "Set active transient's value for this Emacs session and exit.") | 2988 | "Set active transient's value for this Emacs session and exit.") |
| 2987 | 2989 | ||
| 2988 | (defun transient-save () | 2990 | (defun transient-save () |
| @@ -2990,7 +2992,7 @@ transient is active." | |||
| 2990 | (interactive) | 2992 | (interactive) |
| 2991 | (transient-save-value (transient-prefix-object))) | 2993 | (transient-save-value (transient-prefix-object))) |
| 2992 | 2994 | ||
| 2993 | (defalias 'transient-save-and-exit 'transient-save | 2995 | (defalias 'transient-save-and-exit #'transient-save |
| 2994 | "Save active transient's value for this and future Emacs sessions and exit.") | 2996 | "Save active transient's value for this and future Emacs sessions and exit.") |
| 2995 | 2997 | ||
| 2996 | (defun transient-reset () | 2998 | (defun transient-reset () |