comparison lisp/help.el @ 6902:962a6ffb7b97

(describe-mode): Always show minor modes, at front.
author Richard M. Stallman <rms@gnu.org>
date Fri, 15 Apr 1994 23:47:08 +0000
parents 4c20c6b1d2c2
children 61d9d9b5ccba
comparison
equal deleted inserted replaced
6901:01e7faac0761 6902:962a6ffb7b97
166 (if (documentation defn) 166 (if (documentation defn)
167 (princ (documentation defn)) 167 (princ (documentation defn))
168 (princ "not documented")) 168 (princ "not documented"))
169 (print-help-return-message))))) 169 (print-help-return-message)))))
170 170
171 (defun describe-mode (&optional minor) 171 (defun describe-mode ()
172 "Display documentation of current major mode. 172 "Display documentation of current major mode and minor modes.
173 If optional MINOR is non-nil (or prefix argument is given if interactive),
174 display documentation of active minor modes as well.
175 For this to work correctly for a minor mode, the mode's indicator variable 173 For this to work correctly for a minor mode, the mode's indicator variable
176 \(listed in `minor-mode-alist') must also be a function whose documentation 174 \(listed in `minor-mode-alist') must also be a function whose documentation
177 describes the minor mode." 175 describes the minor mode."
178 (interactive) 176 (interactive "p")
179 (with-output-to-temp-buffer "*Help*" 177 (with-output-to-temp-buffer "*Help*"
178 (if minor
179 (let ((minor-modes minor-mode-alist)
180 (locals (buffer-local-variables)))
181 (while minor-modes
182 (let* ((minor-mode (car (car minor-modes)))
183 (indicator (car (cdr (car minor-modes))))
184 (local-binding (assq minor-mode locals)))
185 ;; Document a minor mode if it is listed in minor-mode-alist,
186 ;; bound locally in this buffer, non-nil, and has a function
187 ;; definition.
188 (if (and local-binding
189 (cdr local-binding)
190 (fboundp minor-mode))
191 (let ((pretty-minor-mode minor-mode))
192 (if (string-match "-mode$" (symbol-name minor-mode))
193 (setq pretty-minor-mode
194 (capitalize
195 (substring (symbol-name minor-mode)
196 0 (match-beginning 0)))))
197 (while (and indicator (symbolp indicator))
198 (setq indicator (symbol-value indicator)))
199 (princ (format "%s minor mode (indicator%s):\n"
200 pretty-minor-mode indicator))
201 (princ (documentation minor-mode))
202 (princ "\n\n"))))
203 (setq minor-modes (cdr minor-modes)))))
180 (princ mode-name) 204 (princ mode-name)
181 (princ " Mode:\n") 205 (princ " mode:\n")
182 (princ (documentation major-mode)) 206 (princ (documentation major-mode))
183 (let ((minor-modes minor-mode-alist)
184 (locals (buffer-local-variables)))
185 (while minor-modes
186 (let* ((minor-mode (car (car minor-modes)))
187 (indicator (car (cdr (car minor-modes))))
188 (local-binding (assq minor-mode locals)))
189 ;; Document a minor mode if it is listed in minor-mode-alist,
190 ;; bound locally in this buffer, non-nil, and has a function
191 ;; definition.
192 (if (and local-binding
193 (cdr local-binding)
194 (fboundp minor-mode))
195 (progn
196 (princ (format "\n\n\n%s minor mode (indicator%s):\n"
197 minor-mode indicator))
198 (princ (documentation minor-mode)))))
199 (setq minor-modes (cdr minor-modes))))
200 (print-help-return-message))) 207 (print-help-return-message)))
201 208
202 ;; So keyboard macro definitions are documented correctly 209 ;; So keyboard macro definitions are documented correctly
203 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro)) 210 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
204 211