Fix problem with the newly introduces `minor-modes' variable

* lisp/help-fns.el (describe-mode): Apparently buffer-local
variables take precedence over lexically bound variables?
This commit is contained in:
Lars Ingebrigtsen 2021-02-14 14:43:24 +01:00
parent c0221990c4
commit 4be98d5575

View file

@ -1743,7 +1743,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)
@ -1766,19 +1766,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)))