comparison lisp/help.el @ 23778:9cee50f0ec56

(describe-mode): Put major mode first.
author Richard M. Stallman <rms@gnu.org>
date Sun, 29 Nov 1998 00:56:49 +0000
parents ea095fa15fb9
children 2bb8777a3ba7
comparison
equal deleted inserted replaced
23777:5d10105c2906 23778:9cee50f0ec56
326 (describe-function-1 defn nil) 326 (describe-function-1 defn nil)
327 (print-help-return-message))))))) 327 (print-help-return-message)))))))
328 328
329 (defun describe-mode () 329 (defun describe-mode ()
330 "Display documentation of current major mode and minor modes. 330 "Display documentation of current major mode and minor modes.
331 The major mode description comes first, followed by the minor modes,
332 each on a separate page.
333
331 For this to work correctly for a minor mode, the mode's indicator variable 334 For this to work correctly for a minor mode, the mode's indicator variable
332 \(listed in `minor-mode-alist') must also be a function whose documentation 335 \(listed in `minor-mode-alist') must also be a function whose documentation
333 describes the minor mode." 336 describes the minor mode."
334 (interactive) 337 (interactive)
335 (with-output-to-temp-buffer "*Help*" 338 (with-output-to-temp-buffer "*Help*"
336 (let ((minor-modes minor-mode-alist) 339 (when minor-mode-alist
337 (first t)) 340 (princ "The major mode is described first.
341 For minor modes, see following pages.\n\n"))
342 (princ mode-name)
343 (princ " mode:\n")
344 (princ (documentation major-mode))
345 (help-setup-xref (list #'help-xref-mode (current-buffer)) (interactive-p))
346 (let ((minor-modes minor-mode-alist))
338 (while minor-modes 347 (while minor-modes
339 (let* ((minor-mode (car (car minor-modes))) 348 (let* ((minor-mode (car (car minor-modes)))
340 (indicator (car (cdr (car minor-modes))))) 349 (indicator (car (cdr (car minor-modes)))))
341 ;; Document a minor mode if it is listed in minor-mode-alist, 350 ;; Document a minor mode if it is listed in minor-mode-alist,
342 ;; bound locally in this buffer, non-nil, and has a function 351 ;; bound locally in this buffer, non-nil, and has a function
351 0 (match-beginning 0))))) 360 0 (match-beginning 0)))))
352 (while (and indicator (symbolp indicator) 361 (while (and indicator (symbolp indicator)
353 (boundp indicator) 362 (boundp indicator)
354 (not (eq indicator (symbol-value indicator)))) 363 (not (eq indicator (symbol-value indicator))))
355 (setq indicator (symbol-value indicator))) 364 (setq indicator (symbol-value indicator)))
356 (if first 365 (princ "\n\f\n")
357 (princ "The minor modes are described first,
358 followed by the major mode, which is described on the last page.\n\f\n"))
359 (setq first nil)
360 (princ (format "%s minor mode (%s):\n" 366 (princ (format "%s minor mode (%s):\n"
361 pretty-minor-mode 367 pretty-minor-mode
362 (if indicator 368 (if indicator
363 (format "indicator%s" indicator) 369 (format "indicator%s" indicator)
364 "no indicator"))) 370 "no indicator")))
365 (princ (documentation minor-mode)) 371 (princ (documentation minor-mode)))))
366 (princ "\n\f\n"))))
367 (setq minor-modes (cdr minor-modes)))) 372 (setq minor-modes (cdr minor-modes))))
368 (princ mode-name)
369 (princ " mode:\n")
370 (princ (documentation major-mode))
371 (help-setup-xref (list #'help-xref-mode (current-buffer)) (interactive-p))
372 (print-help-return-message))) 373 (print-help-return-message)))
373 374
374 ;; So keyboard macro definitions are documented correctly 375 ;; So keyboard macro definitions are documented correctly
375 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro)) 376 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
376 377