From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: describe-mode should first summarize all modes in effect
Date: Mon, 29 Sep 2003 15:32:27 -0400 [thread overview]
Message-ID: <E1A43kx-0002iN-FA@fencepost.gnu.org> (raw)
In-Reply-To: <87wubux1v6.fsf_-_@jidanni.org> (message from Dan Jacobson on Sat, 27 Sep 2003 12:59:57 +0800)
What do you think of this version?
(defun describe-mode (&optional buffer)
"Display documentation of current major mode and minor modes.
The major mode description comes first, followed by the minor modes,
each on a separate page.
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)
(help-setup-xref (list #'describe-mode (or buffer (current-buffer)))
(interactive-p))
;; For the sake of help-do-xref and help-xref-go-back,
;; don't switch buffers before calling `help-buffer'.
(with-output-to-temp-buffer (help-buffer)
(save-excursion
(when buffer (set-buffer buffer))
(let (minor-modes)
;; Find enabled minor mode we will want to mention.
(dolist (mode minor-mode-list)
;; Document a minor mode if it is listed in minor-mode-alist,
;; non-nil, and has a function definition.
(and (boundp mode) (symbol-value mode)
(fboundp mode)
(let ((pretty-minor-mode mode)
indicator)
(if (string-match "\\(-minor\\)?-mode\\'"
(symbol-name mode))
(setq pretty-minor-mode
(capitalize
(substring (symbol-name mode)
0 (match-beginning 0)))))
(setq indicator (cadr (assq mode minor-mode-alist)))
(while (and indicator (symbolp indicator)
(boundp indicator)
(not (eq indicator (symbol-value indicator))))
(setq indicator (symbol-value indicator)))
(push (list pretty-minor-mode mode indicator)
minor-modes))))
(if auto-fill-function
(push '("Auto Fill" auto-fill-mode " Fill")
minor-modes))
(setq minor-modes
(sort minor-modes
(lambda (a b) (string-lessp (car a) (car b)))))
(when minor-modes
(princ "Summary of minor modes:\n")
(dolist (mode minor-modes)
(let ((pretty-minor-mode (nth 0 mode))
(indicator (nth 2 mode)))
(princ (format " %s minor mode (%s):\n"
pretty-minor-mode
(if indicator
(format "indicator%s" indicator)
"no indicator")))))
(princ "\n(Full information about these minor modes
follows the description of the major mode.)\n\n"))
;; Document the major mode.
(princ mode-name)
(princ " mode:\n")
(princ (documentation major-mode))
;; Document the minor modes fully.
(dolist (mode minor-modes)
(let ((pretty-minor-mode (nth 0 mode))
(mode-function (nth 1 mode))
(indicator (nth 2 mode)))
(princ "\n\f\n")
(princ (format "%s minor mode (%s):\n"
pretty-minor-mode
(if indicator
(format "indicator%s" indicator)
"no indicator")))
(princ (documentation mode-function)))))
(print-help-return-message))))
next prev parent reply other threads:[~2003-09-29 19:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.443.1064004252.21628.bug-gnu-emacs@gnu.org>
2003-09-22 15:29 ` report-emacs-bug could also list current modes Kevin Rodgers
2003-09-24 21:46 ` stop rewriting Message-IDs Dan Jacobson
2003-09-24 21:50 ` report-emacs-bug could also list current modes Dan Jacobson
[not found] ` <mailman.677.1064447066.21628.bug-gnu-emacs@gnu.org>
2003-09-25 14:55 ` Kevin Rodgers
2003-09-25 16:16 ` Andreas Schwab
2003-09-27 4:59 ` describe-mode should first summarize all modes in effect Dan Jacobson
2003-09-29 19:32 ` Richard Stallman [this message]
[not found] ` <mailman.819.1064714879.21628.bug-gnu-emacs@gnu.org>
2003-09-29 17:10 ` Kevin Rodgers
2003-10-02 22:27 ` Dan Jacobson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1A43kx-0002iN-FA@fencepost.gnu.org \
--to=rms@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.