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

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

describe-mode "some-mode": (documentation some-mode) (was: IELM)


From: lee
Subject: describe-mode "some-mode": (documentation some-mode) (was: IELM)
Date: Sat, 23 Aug 2014 15:20:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Emanuel Berg <address@hidden> writes:

> Emanuel Berg <address@hidden> writes:
>
>> It is OK, but the OP is right, and that code should
>> be made official, if there isn't anything else to
>> this extent.
>>
>> Isn't there some REPL mode where, like in Clojure,
>> you can do for example (source n) and (doc name)?
>
> Found it (sort of).
>
> It is `M-x ielm' and then (documentation FUNCTION). It
> works only for functions. But faces and variables also
> have documentation... There should be a generic such
> command!
>
> I didn't find a (source n) equivalent.
>
> Also, the IELM and/or `documentation' doesn't seem to
> wrap lines or respect the \n in the docstrings. Makes
> it a lot less practical.


(defun my-describe-mode ()
  "Display the documentation of MODE."
  (interactive)
  (let ((mode (list (intern (read-string "Mode: ")))))
    (unless (functionp mode)
      (with-current-buffer (switch-to-buffer-other-window "my-describe-mode")
        (insert (documentation mode))))))


This inserts "Keyboard macro." into the buffer (without the quotes).
I'm not too sure about what I'm doing here ...

When I use (help-buffer) instead of "my-describe-mode" for a buffer, the
(help-buffer) might be read-only?


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