From: Eshel Yaron Date: Mon, 17 Jun 2024 16:50:52 +0000 (+0200) Subject: (describe-{function,command,variable,symbol,keymap}): Add action X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=73cde39af510f31bfeacd83a84ad58093421c1b2;p=emacs.git (describe-{function,command,variable,symbol,keymap}): Add action --- diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 426c5e2ff79..630b2110902 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -322,6 +322,7 @@ handling of autoloaded functions." (let ((describe-function-orig-buffer (or describe-function-orig-buffer (current-buffer))) + (function (if (stringp function) (intern function) function)) (help-buffer-under-preparation t)) (help-setup-xref (list #'describe-function--helper @@ -341,6 +342,8 @@ handling of autoloaded functions." ;; Return the text we displayed. (buffer-string)))))) +(put 'describe-function 'minibuffer-action "describe") + ;;;###autoload (defun describe-command (command) "Display the full documentation of COMMAND (a symbol). @@ -348,6 +351,8 @@ When called from Lisp, COMMAND may also be a function object." (interactive (help-fns--describe-function-or-command-prompt 'is-command)) (describe-function command)) +(put 'describe-command 'minibuffer-action 'describe-function) + ;; Could be this, if we make symbol-file do the work below. ;; (defun help-C-file-name (subr-or-var kind) ;; "Return the name of the C file where SUBR-OR-VAR is defined. @@ -1340,6 +1345,7 @@ it is displayed along with the global value." (help-buffer-under-preparation t)) (unless (buffer-live-p buffer) (setq buffer (current-buffer))) (unless (frame-live-p frame) (setq frame (selected-frame))) + (when (stringp variable) (setq variable (intern variable))) (if (not (symbolp variable)) (user-error "You didn't specify a variable") (save-excursion @@ -1524,6 +1530,8 @@ it is displayed along with the global value." ;; Return the text we displayed. (buffer-string)))))))) +(put 'describe-variable 'minibuffer-action "describe") + (defun help-fns--editable-variable (start end variable value buffer) (when (and (readablep value) help-enable-variable-value-editing) @@ -1936,7 +1944,8 @@ current buffer and the selected frame, respectively." (if found (symbol-name v-or-f))))) (list (if (equal val "") (or v-or-f "") (intern val))))) - (let ((help-buffer-under-preparation t)) + (let ((help-buffer-under-preparation t) + (symbol (if (stringp symbol) (intern symbol) symbol))) (if (not (symbolp symbol)) (user-error "You didn't specify a function or variable")) (unless (buffer-live-p buffer) (setq buffer (current-buffer))) @@ -1960,8 +1969,8 @@ current buffer and the selected frame, respectively." (while (cdr docs) (goto-char (point-min)) (let ((inhibit-read-only t) - (name (caar docs)) ;Name of doc currently at BOB. - (doc (cdr (cadr docs)))) ;Doc to add at BOB. + (name (caar docs)) ;Name of doc currently at BOB. + (doc (cdr (cadr docs)))) ;Doc to add at BOB. (when doc (insert doc) (delete-region (point) @@ -1979,6 +1988,8 @@ current buffer and the selected frame, respectively." (help-xref--navigation-buttons) (goto-char (point-min)))))) +(put 'describe-symbol 'minibuffer-action "describe") + ;;;###autoload (defun describe-syntax (&optional buffer) "Describe the syntax specifications in the syntax table of BUFFER. @@ -2123,7 +2134,8 @@ keymap value." (user-error "Not a keymap: %s" km)) (list km))) (let (used-gentemp - (help-buffer-under-preparation t)) + (help-buffer-under-preparation t) + (keymap (if (stringp keymap) (intern keymap) keymap))) (unless (and (symbolp keymap) (boundp keymap) (keymapp (symbol-value keymap))) @@ -2170,6 +2182,9 @@ keymap value." ;; Cleanup. (when used-gentemp (makunbound keymap)))) + +(put 'describe-keymap 'minibuffer-action "describe") + (defcustom describe-mode-outline t "Non-nil enables outlines in the output buffer of `describe-mode'."