emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 db96b1282f: * lisp/help.el: Use 'C-h C-q' to toggle 'help-quick


From: Juri Linkov
Subject: emacs-29 db96b1282f: * lisp/help.el: Use 'C-h C-q' to toggle 'help-quick' window (bug#60249).
Date: Wed, 28 Dec 2022 13:50:25 -0500 (EST)

branch: emacs-29
commit db96b1282f90ee40560f81e8b715fe785badbb6e
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/help.el: Use 'C-h C-q' to toggle 'help-quick' window (bug#60249).
    
    (help-map): Bind "C-q" to 'help-quick-toggle'.  Rebind "q" to 'help-quit'.
    (help-quick): Replace help-quit-or-quick with help-quick-toggle.
    (help-quick-toggle): New command.
    (help-quit-or-quick): Remove command.
    (help-for-help): Replace help-quick-or-quit with help-quick-toggle.
---
 etc/NEWS     |  2 +-
 lisp/help.el | 32 ++++++++++++++------------------
 2 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 0d1ab998e8..d2e11e5adf 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1077,7 +1077,7 @@ the default candidate.
 *** New command 'help-quick' displays an overview of common commands.
 The command pops up a buffer at the bottom of the screen with a few
 helpful commands for various tasks.  You can toggle the display using
-'C-h q'.
+'C-h C-q'.
 
 ** Emacs now comes with Org v9.6.
 See the file ORG-NEWS for user-visible changes in Org.
diff --git a/lisp/help.el b/lisp/help.el
index b709062cb2..d7fd4d555e 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -76,6 +76,7 @@ buffer.")
   "C-n"  #'view-emacs-news
   "C-o"  #'describe-distribution
   "C-p"  #'view-emacs-problems
+  "C-q"  #'help-quick-toggle
   "C-s"  #'search-forward-help-for-help
   "C-t"  #'view-emacs-todo
   "C-w"  #'describe-no-warranty
@@ -116,7 +117,7 @@ buffer.")
   "v"    #'describe-variable
   "w"    #'where-is
   "x"    #'describe-command
-  "q"    #'help-quit-or-quick)
+  "q"    #'help-quit)
 
 (define-key global-map (char-to-string help-char) 'help-command)
 (define-key global-map [help] 'help-command)
@@ -243,7 +244,17 @@ buffer.")
       ;; ... and shrink it immediately.
       (fit-window-to-buffer))
     (message
-     (substitute-command-keys "Toggle the quick help buffer using 
\\[help-quit-or-quick]."))))
+     (substitute-command-keys "Toggle the quick help buffer using 
\\[help-quick-toggle]."))))
+
+(defun help-quick-toggle ()
+  "Toggle the quick-help window."
+  (interactive)
+  (if (and-let* ((window (get-buffer-window "*Quick Help*")))
+        (quit-window t window))
+      ;; Clear the message we may have gotten from `C-h' and then
+      ;; waiting before hitting `q'.
+      (message "")
+    (help-quick)))
 
 (defalias 'cheat-sheet #'help-quick)
 
@@ -252,21 +263,6 @@ buffer.")
   (interactive)
   nil)
 
-(defun help-quit-or-quick ()
-  "Call `help-quit' or  `help-quick' depending on the context."
-  (interactive)
-  (cond
-   (help-buffer-under-preparation
-    ;; FIXME: There should be a better way to detect if we are in the
-    ;;        help command loop.
-    (help-quit))
-   ((and-let* ((window (get-buffer-window "*Quick Help*")))
-      (quit-window t window)
-      ;; Clear the message we may have gotten from `C-h' and then
-      ;; waiting before hitting `q'.
-      (message "")))
-   ((help-quick))))
-
 (defvar help-return-method nil
   "What to do to \"exit\" the help buffer.
 This is a list
@@ -416,7 +412,7 @@ Do not call this in the scope of `with-help-window'."
        ("describe-package" "Describe a specific Emacs package")
        ""
        ("help-with-tutorial" "Start the Emacs tutorial")
-       ("help-quick-or-quit" "Display the quick help buffer.")
+       ("help-quick-toggle" "Display the quick help buffer.")
        ("view-echo-area-messages"
         "Show recent messages (from echo area)")
        ("view-lossage" ,(format "Show last %d input keystrokes (lossage)"



reply via email to

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