diff options
| author | Juri Linkov | 2022-12-28 20:48:40 +0200 |
|---|---|---|
| committer | Juri Linkov | 2022-12-28 20:49:23 +0200 |
| commit | db96b1282f90ee40560f81e8b715fe785badbb6e (patch) | |
| tree | 8b5a49727cc218dab538fa05c769ddd19a34d784 | |
| parent | 489865c21e41b3f896ab2e57784b2f43dfb4829b (diff) | |
| download | emacs-db96b1282f90ee40560f81e8b715fe785badbb6e.tar.gz emacs-db96b1282f90ee40560f81e8b715fe785badbb6e.zip | |
* 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.
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/help.el | 32 |
2 files changed, 15 insertions, 19 deletions
| @@ -1077,7 +1077,7 @@ the default candidate. | |||
| 1077 | *** New command 'help-quick' displays an overview of common commands. | 1077 | *** New command 'help-quick' displays an overview of common commands. |
| 1078 | The command pops up a buffer at the bottom of the screen with a few | 1078 | The command pops up a buffer at the bottom of the screen with a few |
| 1079 | helpful commands for various tasks. You can toggle the display using | 1079 | helpful commands for various tasks. You can toggle the display using |
| 1080 | 'C-h q'. | 1080 | 'C-h C-q'. |
| 1081 | 1081 | ||
| 1082 | ** Emacs now comes with Org v9.6. | 1082 | ** Emacs now comes with Org v9.6. |
| 1083 | See the file ORG-NEWS for user-visible changes in Org. | 1083 | See the file ORG-NEWS for user-visible changes in Org. |
diff --git a/lisp/help.el b/lisp/help.el index b709062cb27..d7fd4d555ea 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -76,6 +76,7 @@ buffer.") | |||
| 76 | "C-n" #'view-emacs-news | 76 | "C-n" #'view-emacs-news |
| 77 | "C-o" #'describe-distribution | 77 | "C-o" #'describe-distribution |
| 78 | "C-p" #'view-emacs-problems | 78 | "C-p" #'view-emacs-problems |
| 79 | "C-q" #'help-quick-toggle | ||
| 79 | "C-s" #'search-forward-help-for-help | 80 | "C-s" #'search-forward-help-for-help |
| 80 | "C-t" #'view-emacs-todo | 81 | "C-t" #'view-emacs-todo |
| 81 | "C-w" #'describe-no-warranty | 82 | "C-w" #'describe-no-warranty |
| @@ -116,7 +117,7 @@ buffer.") | |||
| 116 | "v" #'describe-variable | 117 | "v" #'describe-variable |
| 117 | "w" #'where-is | 118 | "w" #'where-is |
| 118 | "x" #'describe-command | 119 | "x" #'describe-command |
| 119 | "q" #'help-quit-or-quick) | 120 | "q" #'help-quit) |
| 120 | 121 | ||
| 121 | (define-key global-map (char-to-string help-char) 'help-command) | 122 | (define-key global-map (char-to-string help-char) 'help-command) |
| 122 | (define-key global-map [help] 'help-command) | 123 | (define-key global-map [help] 'help-command) |
| @@ -243,7 +244,17 @@ buffer.") | |||
| 243 | ;; ... and shrink it immediately. | 244 | ;; ... and shrink it immediately. |
| 244 | (fit-window-to-buffer)) | 245 | (fit-window-to-buffer)) |
| 245 | (message | 246 | (message |
| 246 | (substitute-command-keys "Toggle the quick help buffer using \\[help-quit-or-quick].")))) | 247 | (substitute-command-keys "Toggle the quick help buffer using \\[help-quick-toggle].")))) |
| 248 | |||
| 249 | (defun help-quick-toggle () | ||
| 250 | "Toggle the quick-help window." | ||
| 251 | (interactive) | ||
| 252 | (if (and-let* ((window (get-buffer-window "*Quick Help*"))) | ||
| 253 | (quit-window t window)) | ||
| 254 | ;; Clear the message we may have gotten from `C-h' and then | ||
| 255 | ;; waiting before hitting `q'. | ||
| 256 | (message "") | ||
| 257 | (help-quick))) | ||
| 247 | 258 | ||
| 248 | (defalias 'cheat-sheet #'help-quick) | 259 | (defalias 'cheat-sheet #'help-quick) |
| 249 | 260 | ||
| @@ -252,21 +263,6 @@ buffer.") | |||
| 252 | (interactive) | 263 | (interactive) |
| 253 | nil) | 264 | nil) |
| 254 | 265 | ||
| 255 | (defun help-quit-or-quick () | ||
| 256 | "Call `help-quit' or `help-quick' depending on the context." | ||
| 257 | (interactive) | ||
| 258 | (cond | ||
| 259 | (help-buffer-under-preparation | ||
| 260 | ;; FIXME: There should be a better way to detect if we are in the | ||
| 261 | ;; help command loop. | ||
| 262 | (help-quit)) | ||
| 263 | ((and-let* ((window (get-buffer-window "*Quick Help*"))) | ||
| 264 | (quit-window t window) | ||
| 265 | ;; Clear the message we may have gotten from `C-h' and then | ||
| 266 | ;; waiting before hitting `q'. | ||
| 267 | (message ""))) | ||
| 268 | ((help-quick)))) | ||
| 269 | |||
| 270 | (defvar help-return-method nil | 266 | (defvar help-return-method nil |
| 271 | "What to do to \"exit\" the help buffer. | 267 | "What to do to \"exit\" the help buffer. |
| 272 | This is a list | 268 | This is a list |
| @@ -416,7 +412,7 @@ Do not call this in the scope of `with-help-window'." | |||
| 416 | ("describe-package" "Describe a specific Emacs package") | 412 | ("describe-package" "Describe a specific Emacs package") |
| 417 | "" | 413 | "" |
| 418 | ("help-with-tutorial" "Start the Emacs tutorial") | 414 | ("help-with-tutorial" "Start the Emacs tutorial") |
| 419 | ("help-quick-or-quit" "Display the quick help buffer.") | 415 | ("help-quick-toggle" "Display the quick help buffer.") |
| 420 | ("view-echo-area-messages" | 416 | ("view-echo-area-messages" |
| 421 | "Show recent messages (from echo area)") | 417 | "Show recent messages (from echo area)") |
| 422 | ("view-lossage" ,(format "Show last %d input keystrokes (lossage)" | 418 | ("view-lossage" ,(format "Show last %d input keystrokes (lossage)" |