aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov2021-05-20 21:37:04 +0300
committerJuri Linkov2021-05-20 21:37:04 +0300
commite0ebce5ce2ba76779a5a74dcffba60b83cf9df2f (patch)
treeb5b2a73463027bf217892b15e8880a21538e4d0f /lisp
parent9be9d1f94ed6506f5b9659dfb40e5b5d8cdb3310 (diff)
downloademacs-e0ebce5ce2ba76779a5a74dcffba60b83cf9df2f.tar.gz
emacs-e0ebce5ce2ba76779a5a74dcffba60b83cf9df2f.zip
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/help.el43
1 files changed, 26 insertions, 17 deletions
diff --git a/lisp/help.el b/lisp/help.el
index babaf4adc75..1bb1b307723 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -561,6 +561,12 @@ To record all your input, use `open-dribble-file'."
561 'font-lock-face 'help-key-binding 561 'font-lock-face 'help-key-binding
562 'face 'help-key-binding)) 562 'face 'help-key-binding))
563 563
564(defcustom describe-bindings-outline nil
565 "Non-nil enables outlines in the output buffer of `describe-bindings'."
566 :type 'boolean
567 :group 'help
568 :version "28.1")
569
564(defun describe-bindings (&optional prefix buffer) 570(defun describe-bindings (&optional prefix buffer)
565 "Display a buffer showing a list of all defined keys, and their definitions. 571 "Display a buffer showing a list of all defined keys, and their definitions.
566The keys are displayed in order of precedence. 572The keys are displayed in order of precedence.
@@ -578,23 +584,26 @@ or a buffer name."
578 ;; Be aware that `describe-buffer-bindings' puts its output into 584 ;; Be aware that `describe-buffer-bindings' puts its output into
579 ;; the current buffer. 585 ;; the current buffer.
580 (with-current-buffer (help-buffer) 586 (with-current-buffer (help-buffer)
581 (describe-buffer-bindings buffer prefix)))) 587 (describe-buffer-bindings buffer prefix)
582 588
583(defun describe-bindings-internal (&optional menus prefix) 589 (when describe-bindings-outline
584 "Show a list of all defined keys, and their definitions. 590 (setq-local outline-regexp ".*:$")
585We put that list in a buffer, and display the buffer. 591 (setq-local outline-heading-end-regexp ":\n")
586 592 (setq-local outline-level (lambda () 1))
587The optional argument MENUS, if non-nil, says to mention menu bindings. 593 (setq-local outline-minor-mode-cycle t
588\(Ordinarily these are omitted from the output.) 594 outline-minor-mode-highlight t)
589The optional argument PREFIX, if non-nil, should be a key sequence; 595 (outline-minor-mode 1)
590then we display only bindings that start with that prefix." 596 (save-excursion
591 (declare (obsolete describe-buffer-bindings "24.4")) 597 (let ((inhibit-read-only t))
592 (let ((buf (current-buffer))) 598 (goto-char (point-min))
593 (with-help-window (help-buffer) 599 (insert (substitute-command-keys
594 ;; Be aware that `describe-buffer-bindings' puts its output into 600 (concat "\\<outline-mode-cycle-map>Type "
595 ;; the current buffer. 601 "\\[outline-cycle] or \\[outline-cycle-buffer] "
596 (with-current-buffer (help-buffer) 602 "on headings to cycle their visibility.\n\n")))
597 (describe-buffer-bindings buf prefix menus))))) 603 ;; Hide the longest body
604 (when (and (re-search-forward "Key translations" nil t)
605 (fboundp 'outline-cycle))
606 (outline-cycle))))))))
598 607
599(defun where-is (definition &optional insert) 608(defun where-is (definition &optional insert)
600 "Print message listing key sequences that invoke the command DEFINITION. 609 "Print message listing key sequences that invoke the command DEFINITION.