mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-08 04:30:45 -08:00
* lisp/help.el (describe-bindings-outline): New defcustom (bug#45147).
(describe-bindings): Use describe-bindings-outline. (describe-bindings-internal): Remove function obsolete since 24.4.
This commit is contained in:
parent
9be9d1f94e
commit
e0ebce5ce2
2 changed files with 30 additions and 16 deletions
5
etc/NEWS
5
etc/NEWS
|
|
@ -1052,6 +1052,11 @@ commands and is globally bound to `C-h x'.
|
||||||
+++
|
+++
|
||||||
*** New command 'describe-keymap' describes keybindings in a keymap.
|
*** New command 'describe-keymap' describes keybindings in a keymap.
|
||||||
|
|
||||||
|
---
|
||||||
|
*** New user option 'describe-bindings-outline'.
|
||||||
|
It enables outlines in the output buffer of `describe-bindings' that
|
||||||
|
can provide a better overview in a long list of available bindings.
|
||||||
|
|
||||||
---
|
---
|
||||||
*** New keybinding 'C-h R' prompts for a manual to display and displays it.
|
*** New keybinding 'C-h R' prompts for a manual to display and displays it.
|
||||||
|
|
||||||
|
|
|
||||||
41
lisp/help.el
41
lisp/help.el
|
|
@ -561,6 +561,12 @@ To record all your input, use `open-dribble-file'."
|
||||||
'font-lock-face 'help-key-binding
|
'font-lock-face 'help-key-binding
|
||||||
'face 'help-key-binding))
|
'face 'help-key-binding))
|
||||||
|
|
||||||
|
(defcustom describe-bindings-outline nil
|
||||||
|
"Non-nil enables outlines in the output buffer of `describe-bindings'."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'help
|
||||||
|
:version "28.1")
|
||||||
|
|
||||||
(defun describe-bindings (&optional prefix buffer)
|
(defun describe-bindings (&optional prefix buffer)
|
||||||
"Display a buffer showing a list of all defined keys, and their definitions.
|
"Display a buffer showing a list of all defined keys, and their definitions.
|
||||||
The keys are displayed in order of precedence.
|
The keys are displayed in order of precedence.
|
||||||
|
|
@ -578,23 +584,26 @@ or a buffer name."
|
||||||
;; Be aware that `describe-buffer-bindings' puts its output into
|
;; Be aware that `describe-buffer-bindings' puts its output into
|
||||||
;; the current buffer.
|
;; the current buffer.
|
||||||
(with-current-buffer (help-buffer)
|
(with-current-buffer (help-buffer)
|
||||||
(describe-buffer-bindings buffer prefix))))
|
(describe-buffer-bindings buffer prefix)
|
||||||
|
|
||||||
(defun describe-bindings-internal (&optional menus prefix)
|
(when describe-bindings-outline
|
||||||
"Show a list of all defined keys, and their definitions.
|
(setq-local outline-regexp ".*:$")
|
||||||
We put that list in a buffer, and display the buffer.
|
(setq-local outline-heading-end-regexp ":\n")
|
||||||
|
(setq-local outline-level (lambda () 1))
|
||||||
The optional argument MENUS, if non-nil, says to mention menu bindings.
|
(setq-local outline-minor-mode-cycle t
|
||||||
\(Ordinarily these are omitted from the output.)
|
outline-minor-mode-highlight t)
|
||||||
The optional argument PREFIX, if non-nil, should be a key sequence;
|
(outline-minor-mode 1)
|
||||||
then we display only bindings that start with that prefix."
|
(save-excursion
|
||||||
(declare (obsolete describe-buffer-bindings "24.4"))
|
(let ((inhibit-read-only t))
|
||||||
(let ((buf (current-buffer)))
|
(goto-char (point-min))
|
||||||
(with-help-window (help-buffer)
|
(insert (substitute-command-keys
|
||||||
;; Be aware that `describe-buffer-bindings' puts its output into
|
(concat "\\<outline-mode-cycle-map>Type "
|
||||||
;; the current buffer.
|
"\\[outline-cycle] or \\[outline-cycle-buffer] "
|
||||||
(with-current-buffer (help-buffer)
|
"on headings to cycle their visibility.\n\n")))
|
||||||
(describe-buffer-bindings buf prefix menus)))))
|
;; Hide the longest body
|
||||||
|
(when (and (re-search-forward "Key translations" nil t)
|
||||||
|
(fboundp 'outline-cycle))
|
||||||
|
(outline-cycle))))))))
|
||||||
|
|
||||||
(defun where-is (definition &optional insert)
|
(defun where-is (definition &optional insert)
|
||||||
"Print message listing key sequences that invoke the command DEFINITION.
|
"Print message listing key sequences that invoke the command DEFINITION.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue