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

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

Re: describe-mode "some-mode": (documentation some-mode)


From: Michael Heerdegen
Subject: Re: describe-mode "some-mode": (documentation some-mode)
Date: Sun, 31 Aug 2014 00:30:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (gnu/linux)

lee <address@hidden> writes:

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

> Instead of returning the docstring for the mode, (insert (documentation
> mode)) inserts "Keybaord macro." into the buffer with the function I
> defined to do this.
>
> I'm wondering why apparently (documentation mode) returns "Keyboard
> macro." instead of the docstring ...

It doesn't.  You bind `mode' to a list (!) of one element, the function.
You want to bind `mode' to the function itself.  (OTOH, for the
interactive spec, you would want to return a list: the list of read
arguments, which are then bound to the argument variables.)

And then, `unless' should be a `when'.

> What's the defined or supposed behaviour of 'insert when the buffer to
> insert something into is read-only?

Raising an error.

Michael.




reply via email to

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