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

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

Re: Printing documentation string of another function


From: Stephen Berman
Subject: Re: Printing documentation string of another function
Date: Wed, 10 Apr 2024 22:17:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Wed, 10 Apr 2024 20:09:44 +0000 Heime <heimeborgia@protonmail.com> wrote:

> On Thursday, April 11th, 2024 at 7:36 AM, Stephen Berman
> <stephen.berman@gmx.net> wrote:
>
>> On Wed, 10 Apr 2024 17:17:00 +0000 Heime heimeborgia@protonmail.com wrote:
>>
>> > With the following implementation, I cannot get the documentation string
>> > of the appropriate function to display.
>> >
>> > (defun avus-doc (seltr)
>> > "Print the documentation string of a particular function."
>> >
>> > (interactive
>> > (list
>> > (let ( (cseq '("Greek" "Flokki")) )
>> > (completing-read "Doc: " cseq nil t "Greek"))))
>> >
>> > (pcase seltr
>> > ("Greek" (documentation 'avus-greek))
>> > ("Flokki" (documentation 'avus-flokki))) )
>>
>>
>> `(documentation 'avus-greek)' just returns the doc string, it does not
>> display it. You have to add code to do that, e.g.:
>>
>> (defun avus-doc (seltr)
>> "Print the documentation string of a particular function."
>> (interactive
>> (list
>> (let ((cseq '("Greek" "Flokki")))
>> (completing-read "Doc: " cseq nil t "Greek"))))
>> (let ((doc (pcase seltr
>> ("Greek" (documentation 'avus-greek))
>> ("Flokki" (documentation 'avus-flokki)))))
>> (tooltip-show doc)))
>>
>> Steve Berman
>
> I want to print in the usual documentation buffer as doing
> C-h f avus-greek or C-h f avus-flokki

(defun avus-doc (seltr)
  "Print the documentation string of a particular function."
  (interactive
   (list
    (let ((cseq '("Greek" "Flokki")))
      (completing-read "Doc: " cseq nil t "Greek"))))
  (describe-function (pcase seltr
                       ("Greek" 'avus-greek)
                       ("Flokki" 'avus-flokki))))

Steve Berman



reply via email to

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