changeset 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 01e7faac0761
children 61d9d9b5ccba
files lisp/help.el
diffstat 1 files changed, 30 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help.el	Fri Apr 15 22:45:53 1994 +0000
+++ b/lisp/help.el	Fri Apr 15 23:47:08 1994 +0000
@@ -168,35 +168,42 @@
 	  (princ "not documented"))
 	(print-help-return-message)))))
 
-(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)
+  (interactive "p")
   (with-output-to-temp-buffer "*Help*"
+    (if minor
+	(let ((minor-modes minor-mode-alist)
+	      (locals (buffer-local-variables)))
+	  (while minor-modes
+	    (let* ((minor-mode (car (car minor-modes)))
+		   (indicator (car (cdr (car minor-modes))))
+		   (local-binding (assq minor-mode locals)))
+	      ;; Document a minor mode if it is listed in minor-mode-alist,
+	      ;; bound locally in this buffer, non-nil, and has a function
+	      ;; definition.
+	      (if (and local-binding
+		       (cdr local-binding)
+		       (fboundp minor-mode))
+		  (let ((pretty-minor-mode minor-mode))
+		    (if (string-match "-mode$" (symbol-name minor-mode))
+			(setq pretty-minor-mode
+			      (capitalize
+			       (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 " mode:\n")
     (princ (documentation major-mode))
-    (let ((minor-modes minor-mode-alist)
-	  (locals (buffer-local-variables)))
-      (while minor-modes
-	(let* ((minor-mode (car (car minor-modes)))
-	       (indicator (car (cdr (car minor-modes))))
-	       (local-binding (assq minor-mode locals)))
-	  ;; Document a minor mode if it is listed in minor-mode-alist,
-	  ;; bound locally in this buffer, non-nil, and has a function
-	  ;; definition.
-	  (if (and local-binding
-		   (cdr local-binding)
-		   (fboundp minor-mode))
-	      (progn
-		(princ (format "\n\n\n%s minor mode (indicator%s):\n"
-			       minor-mode indicator))
-		(princ (documentation minor-mode)))))
-	(setq minor-modes (cdr minor-modes))))
     (print-help-return-message)))
 
 ;; So keyboard macro definitions are documented correctly