help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: describe-mode "some-mode"?


From: Drew Adams
Subject: RE: describe-mode "some-mode"?
Date: Fri, 22 Aug 2014 11:21:07 -0700 (PDT)

> is there a function like describe-key which describes a mode specified
> by the user?
> 
> The docstring of describe-mode says it either describes the mode of the
> current buffer or of the buffer given.  How can I get a description of a
> mode without enabling the mode in a buffer?

Something like this will get you started. For more info (e.g. to include 
minor-mode info) see the definition of `describe-mode'.  You could also improve 
the interactive spec, to use completion against major modes or something.

(defun my-describe-mode (mode)
  (interactive (list (intern (read-string "Mode: "))))
  (with-help-window (help-buffer)
    (with-current-buffer (help-buffer)
      (insert (help-documentation mode nil 'ADD-HELP-BUTTONS)))))

On the other hand, it is OK and simple to instead create a temporary buffer, 
put it in the mode, and use `describe-mode' there.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]