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

(describe-mode): Fix previous change.

parent ad023904
...@@ -173,34 +173,33 @@ If FUNCTION is nil, applies `message' to it, thus printing it." ...@@ -173,34 +173,33 @@ If FUNCTION is nil, applies `message' to it, thus printing it."
For this to work correctly for a minor mode, the mode's indicator variable 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 \(listed in `minor-mode-alist') must also be a function whose documentation
describes the minor mode." describes the minor mode."
(interactive "p") (interactive)
(with-output-to-temp-buffer "*Help*" (with-output-to-temp-buffer "*Help*"
(if minor (let ((minor-modes minor-mode-alist)
(let ((minor-modes minor-mode-alist) (locals (buffer-local-variables)))
(locals (buffer-local-variables))) (while minor-modes
(while minor-modes (let* ((minor-mode (car (car minor-modes)))
(let* ((minor-mode (car (car minor-modes))) (indicator (car (cdr (car minor-modes))))
(indicator (car (cdr (car minor-modes)))) (local-binding (assq minor-mode locals)))
(local-binding (assq minor-mode locals))) ;; Document a minor mode if it is listed in minor-mode-alist,
;; Document a minor mode if it is listed in minor-mode-alist, ;; bound locally in this buffer, non-nil, and has a function
;; bound locally in this buffer, non-nil, and has a function ;; definition.
;; definition. (if (and local-binding
(if (and local-binding (cdr local-binding)
(cdr local-binding) (fboundp minor-mode))
(fboundp minor-mode)) (let ((pretty-minor-mode minor-mode))
(let ((pretty-minor-mode minor-mode)) (if (string-match "-mode$" (symbol-name minor-mode))
(if (string-match "-mode$" (symbol-name minor-mode)) (setq pretty-minor-mode
(setq pretty-minor-mode (capitalize
(capitalize (substring (symbol-name minor-mode)
(substring (symbol-name minor-mode) 0 (match-beginning 0)))))
0 (match-beginning 0))))) (while (and indicator (symbolp indicator))
(while (and indicator (symbolp indicator)) (setq indicator (symbol-value indicator)))
(setq indicator (symbol-value indicator))) (princ (format "%s minor mode (indicator%s):\n"
(princ (format "%s minor mode (indicator%s):\n" pretty-minor-mode indicator))
pretty-minor-mode indicator)) (princ (documentation minor-mode))
(princ (documentation minor-mode)) (princ "\n\n"))))
(princ "\n\n")))) (setq minor-modes (cdr minor-modes))))
(setq minor-modes (cdr minor-modes)))))
(princ mode-name) (princ mode-name)
(princ " mode:\n") (princ " mode:\n")
(princ (documentation major-mode)) (princ (documentation major-mode))
......
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