summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-02-17 22:26:28 +0100
committerAndrea Corallo <akrl@sdf.org>2021-02-17 22:26:28 +0100
commitf92bb788a073c6b3ca7f188e0edea714598193fd (patch)
tree9bea27955098bfc33d0daaa345cfa3dca5b695fd /lisp/help-fns.el
parent1fe5994bcb8b58012dbba0a5f7d03138c293286f (diff)
parent6735bb3d22dc64f3fe42e4a7f439ea9d62f75b5a (diff)
downloademacs-f92bb788a073c6b3ca7f188e0edea714598193fd.tar.gz
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el37
1 files changed, 29 insertions, 8 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index ddbd11f8fd3..407fb961e6f 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1745,7 +1745,7 @@ documentation for the major and minor modes of that buffer."
;; don't switch buffers before calling `help-buffer'.
(with-help-window (help-buffer)
(with-current-buffer buffer
- (let (minor-modes)
+ (let (minors)
;; Older packages do not register in minor-mode-list but only in
;; minor-mode-alist.
(dolist (x minor-mode-alist)
@@ -1768,19 +1768,19 @@ documentation for the major and minor modes of that buffer."
fmode)))
(push (list fmode pretty-minor-mode
(format-mode-line (assq mode minor-mode-alist)))
- minor-modes)))))
+ minors)))))
;; Narrowing is not a minor mode, but its indicator is part of
;; mode-line-modes.
(when (buffer-narrowed-p)
- (push '(narrow-to-region "Narrow" " Narrow") minor-modes))
- (setq minor-modes
- (sort minor-modes
+ (push '(narrow-to-region "Narrow" " Narrow") minors))
+ (setq minors
+ (sort minors
(lambda (a b) (string-lessp (cadr a) (cadr b)))))
- (when minor-modes
+ (when minors
(princ "Enabled minor modes:\n")
(make-local-variable 'help-button-cache)
(with-current-buffer standard-output
- (dolist (mode minor-modes)
+ (dolist (mode minors)
(let ((mode-function (nth 0 mode))
(pretty-minor-mode (nth 1 mode))
(indicator (nth 2 mode)))
@@ -1829,9 +1829,30 @@ documentation for the major and minor modes of that buffer."
nil t)
(help-xref-button 1 'help-function-def mode file-name)))))
(princ ":\n")
- (princ (help-split-fundoc (documentation major-mode) nil 'doc)))))
+ (princ (help-split-fundoc (documentation major-mode) nil 'doc))
+ (princ (help-fns--list-local-commands)))))
;; For the sake of IELM and maybe others
nil)
+
+(defun help-fns--list-local-commands ()
+ (let ((functions nil))
+ (mapatoms
+ (lambda (sym)
+ (when (and (commandp sym)
+ ;; Ignore aliases.
+ (not (symbolp (symbol-function sym)))
+ ;; Ignore everything bound.
+ (not (where-is-internal sym))
+ (apply #'derived-mode-p (command-modes sym)))
+ (push sym functions))))
+ (with-temp-buffer
+ (when functions
+ (setq functions (sort functions #'string<))
+ (insert "\n\nOther commands for this mode, not bound to any keys:\n\n")
+ (dolist (function functions)
+ (insert (format "`%s'\n" function))))
+ (buffer-string))))
+
;; Widgets.