aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2003-09-30 12:50:44 +0000
committerRichard M. Stallman2003-09-30 12:50:44 +0000
commitf6c57ef6902b38a98dee2e66381a0acfe924c313 (patch)
treeefed7a55d1ffa65b38e9f9a2ea91cb3669d792da
parentbea0003aceeb3f4401bb136b7f63d3fa694791e6 (diff)
downloademacs-f6c57ef6902b38a98dee2e66381a0acfe924c313.tar.gz
emacs-f6c57ef6902b38a98dee2e66381a0acfe924c313.zip
(describe-mode): Start with a brief list of minor modes.
Find them thru minor-mode-list so as to find them all. Show them in alphabetical order.
-rw-r--r--lisp/help.el92
1 files changed, 57 insertions, 35 deletions
diff --git a/lisp/help.el b/lisp/help.el
index f24eef298f9..770bcabb964 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -574,43 +574,65 @@ describes the minor mode."
574 (with-output-to-temp-buffer (help-buffer) 574 (with-output-to-temp-buffer (help-buffer)
575 (save-excursion 575 (save-excursion
576 (when buffer (set-buffer buffer)) 576 (when buffer (set-buffer buffer))
577 (when minor-mode-alist 577 (let (minor-modes)
578 (princ "The major mode is described first. 578 ;; Find enabled minor mode we will want to mention.
579For minor modes, see following pages.\n\n")) 579 (dolist (mode minor-mode-list)
580 (princ mode-name) 580 ;; Document a minor mode if it is listed in minor-mode-alist,
581 (princ " mode:\n") 581 ;; non-nil, and has a function definition.
582 (princ (documentation major-mode)) 582 (and (boundp mode) (symbol-value mode)
583 (let ((minor-modes minor-mode-alist)) 583 (fboundp mode)
584 (while minor-modes 584 (let ((pretty-minor-mode mode)
585 (let* ((minor-mode (car (car minor-modes))) 585 indicator)
586 (indicator (car (cdr (car minor-modes))))) 586 (if (string-match "\\(-minor\\)?-mode\\'"
587 ;; Document a minor mode if it is listed in minor-mode-alist, 587 (symbol-name mode))
588 ;; bound locally in this buffer, non-nil, and has a function 588 (setq pretty-minor-mode
589 ;; definition. 589 (capitalize
590 (if (and (boundp minor-mode) 590 (substring (symbol-name mode)
591 (symbol-value minor-mode) 591 0 (match-beginning 0)))))
592 (fboundp minor-mode)) 592 (setq indicator (cadr (assq mode minor-mode-alist)))
593 (let ((pretty-minor-mode minor-mode)) 593 (while (and indicator (symbolp indicator)
594 (if (string-match "\\(-minor\\)?-mode\\'" 594 (boundp indicator)
595 (symbol-name minor-mode)) 595 (not (eq indicator (symbol-value indicator))))
596 (setq pretty-minor-mode 596 (setq indicator (symbol-value indicator)))
597 (capitalize 597 (push (list pretty-minor-mode mode indicator)
598 (substring (symbol-name minor-mode) 598 minor-modes))))
599 0 (match-beginning 0))))) 599 (if auto-fill-function
600 (while (and indicator (symbolp indicator) 600 (push '("Auto Fill" auto-fill-mode " Fill")
601 (boundp indicator) 601 minor-modes))
602 (not (eq indicator (symbol-value indicator)))) 602 (setq minor-modes
603 (setq indicator (symbol-value indicator))) 603 (sort minor-modes
604 (princ "\n\f\n") 604 (lambda (a b) (string-lessp (car a) (car b)))))
605 (princ (format "%s minor mode (%s):\n" 605 (when minor-modes
606 pretty-minor-mode 606 (princ "Summary of minor modes:\n")
607 (if indicator 607 (dolist (mode minor-modes)
608 (format "indicator%s" indicator) 608 (let ((pretty-minor-mode (nth 0 mode))
609 "no indicator"))) 609 (indicator (nth 2 mode)))
610 (princ (documentation minor-mode))))) 610 (princ (format " %s minor mode (%s):\n"
611 (setq minor-modes (cdr minor-modes)))) 611 pretty-minor-mode
612 (if indicator
613 (format "indicator%s" indicator)
614 "no indicator")))))
615 (princ "\n(Full information about these minor modes
616follows the description of the major mode.)\n\n"))
617 ;; Document the major mode.
618 (princ mode-name)
619 (princ " mode:\n")
620 (princ (documentation major-mode))
621 ;; Document the minor modes fully.
622 (dolist (mode minor-modes)
623 (let ((pretty-minor-mode (nth 0 mode))
624 (mode-function (nth 1 mode))
625 (indicator (nth 2 mode)))
626 (princ "\n\f\n")
627 (princ (format "%s minor mode (%s):\n"
628 pretty-minor-mode
629 (if indicator
630 (format "indicator%s" indicator)
631 "no indicator")))
632 (princ (documentation mode-function)))))
612 (print-help-return-message)))) 633 (print-help-return-message))))
613 634
635
614(defun describe-minor-mode (minor-mode) 636(defun describe-minor-mode (minor-mode)
615 "Display documentation of a minor mode given as MINOR-MODE. 637 "Display documentation of a minor mode given as MINOR-MODE.
616MINOR-MODE can be a minor mode symbol or a minor mode indicator string 638MINOR-MODE can be a minor mode symbol or a minor mode indicator string