From: Juri Linkov Date: Sat, 19 Jun 2021 23:14:29 +0000 (+0300) Subject: Add new convenience command for *Help* X-Git-Tag: emacs-28.0.90~2076 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=415143de47089983bb3f3d6ba1a610d13166969e;p=emacs.git Add new convenience command for *Help* * doc/emacs/help.texi (Help Mode): Document it (bug#36767). * lisp/help-mode.el (help-mode-map): Add 'c'. (help-mode-menu): Add help-customize. (help-customize): New command. --- diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index 8c24a926af5..f144fd29229 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -456,6 +456,8 @@ View the source of the current help topic (if any) (@code{help-view-source}). @item i Look up the current topic in the manual(s) (@code{help-goto-info}). +@item c +Customize the variable or the face (@code{help-customize}). @end table @cindex hyperlink diff --git a/etc/NEWS b/etc/NEWS index b5c1fa79ff8..889a0e690e4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1131,13 +1131,12 @@ This change is for better compatibility with old versions of non-GNU ** Help +++ -*** New command 'help-view-source' ('s') -This command will view the source file (if any) of the current help -topic. - -+++ -*** New command 'help-goto-info' ('i') -This command will look up the current symbol (if any) in Info. +*** New convenience commands with short keys in the Help buffer. +New command 'help-view-source' ('s') will view the source file (if +any) of the current help topic. New command 'help-goto-info' ('i') +will look up the current symbol (if any) in Info. New command +'help-customize' ('c') will customize the variable or the face +(if any) whose doc string is being shown in the Help buffer. --- *** The 'help-for-help' ('C-h C-h') screen has been redesigned. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 48cf435f97c..24b7ffaa2a3 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -46,6 +46,7 @@ (define-key map "\r" 'help-follow) (define-key map "s" 'help-view-source) (define-key map "i" 'help-goto-info) + (define-key map "c" 'help-customize) map) "Keymap for Help mode.") @@ -63,11 +64,13 @@ ["Move to Previous Button" backward-button :help "Move to the Previous Button in the help buffer"] ["Move to Next Button" forward-button - :help "Move to the Next Button in the help buffer"] + :help "Move to the Next Button in the help buffer"] ["View Source" help-view-source :help "Go to the source file for the current help item"] ["Goto Info" help-goto-info - :help "Go to the info node for the current help item"])) + :help "Go to the info node for the current help item"] + ["Customize" help-customize + :help "Customize variable or face"])) (defvar help-mode-tool-bar-map (let ((map (make-sparse-keymap))) @@ -746,6 +749,16 @@ See `help-make-xrefs'." (info-lookup-symbol (plist-get help-mode--current-data :symbol) 'emacs-lisp-mode)) +(defun help-customize () + "Customize variable or face." + (interactive nil help-mode) + (let ((sym (plist-get help-mode--current-data :symbol))) + (unless (or (boundp sym) (facep sym)) + (user-error "No variable or face to customize")) + (cond + ((boundp sym) (customize-variable sym)) + ((facep sym) (customize-face sym))))) + (defun help-do-xref (_pos function args) "Call the help cross-reference function FUNCTION with args ARGS. Things are set up properly so that the resulting help-buffer has