Commit ad023904 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(describe-mode): Always show minor modes, at front.

parent 72f163ea
......@@ -168,18 +168,14 @@ If FUNCTION is nil, applies `message' to it, thus printing it."
(princ "not documented"))
(defun describe-mode (&optional minor)
"Display documentation of current major mode.
If optional MINOR is non-nil (or prefix argument is given if interactive),
display documentation of active minor modes as well.
(defun describe-mode ()
"Display documentation of current major mode and minor modes.
For this to work correctly for a minor mode, the mode's indicator variable
\(listed in `minor-mode-alist') must also be a function whose documentation
describes the minor mode."
(interactive "p")
(with-output-to-temp-buffer "*Help*"
(princ mode-name)
(princ " Mode:\n")
(princ (documentation major-mode))
(if minor
(let ((minor-modes minor-mode-alist)
(locals (buffer-local-variables)))
(while minor-modes
......@@ -192,11 +188,22 @@ describes the minor mode."
(if (and local-binding
(cdr local-binding)
(fboundp minor-mode))
(princ (format "\n\n\n%s minor mode (indicator%s):\n"
minor-mode indicator))
(princ (documentation minor-mode)))))
(setq minor-modes (cdr minor-modes))))
(let ((pretty-minor-mode minor-mode))
(if (string-match "-mode$" (symbol-name minor-mode))
(setq pretty-minor-mode
(substring (symbol-name minor-mode)
0 (match-beginning 0)))))
(while (and indicator (symbolp indicator))
(setq indicator (symbol-value indicator)))
(princ (format "%s minor mode (indicator%s):\n"
pretty-minor-mode indicator))
(princ (documentation minor-mode))
(princ "\n\n"))))
(setq minor-modes (cdr minor-modes)))))
(princ mode-name)
(princ " mode:\n")
(princ (documentation major-mode))
;; So keyboard macro definitions are documented correctly
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment