emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 415143d: Add new convenience command for *Help*


From: Juri Linkov
Subject: master 415143d: Add new convenience command for *Help*
Date: Sat, 19 Jun 2021 19:14:50 -0400 (EDT)

branch: master
commit 415143de47089983bb3f3d6ba1a610d13166969e
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    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.
---
 doc/emacs/help.texi |  2 ++
 etc/NEWS            | 13 ++++++-------
 lisp/help-mode.el   | 17 +++++++++++++++--
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index 8c24a92..f144fd2 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 b5c1fa7..889a0e6 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 48cf435..24b7ffa 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]