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: lee
Subject: Re: describe-mode "some-mode"?
Date: Sat, 23 Aug 2014 14:49:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Drew Adams <drew.adams@oracle.com> writes:

>> 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)))))

,----
| Compiling file /home/lee/emacs/my-helper-functions.el at Sat Aug 23 14:44:35 
2014
| 
| In end of data:
| my-helper-functions.el:116:1:Warning: the function `help-documentation' is not
|     known to be defined.
`----

> 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.

Yes, I thought about writing a function to do just that and thought it
shouldn't be necessary to create a dummy-buffer to see the docstring for
a particular mode.  Emacs is self-documenting :)

It seems I'd have to do just that for now ...


-- 
GNU Emacs 24.4.50.2 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2014-08-17 on yun.yagibdah.de



reply via email to

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