unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Heime <heimeborgia@protonmail.com>
Cc: Joost Kremers <joostkremers@fastmail.fm>,  Zhengyi Fu <i@fuzy.me>,
	Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Printing documentation string of another function
Date: Wed, 10 Apr 2024 22:17:00 +0200	[thread overview]
Message-ID: <87seztht1f.fsf@gmx.net> (raw)
In-Reply-To: <fK5sa6pCKLcgjvosqt-AYPNZe1NniSSgKOCVDu68k3tVcd-C2VZkoNjER7sJvwbnsqUuglxeN0ZPO9McZWr6qgPHviwWshU7FshYjYBwgKA=@protonmail.com> (Heime's message of "Wed, 10 Apr 2024 20:09:44 +0000")

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	other threads:[~2024-04-10 20:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 12:48 Printing documentation string of another function Heime
2024-04-10 12:55 ` Zhengyi Fu
2024-04-10 13:20   ` Heime
2024-04-10 13:22   ` Joost Kremers
2024-04-10 17:17     ` Heime
2024-04-10 19:36       ` Stephen Berman
2024-04-10 20:09         ` Heime
2024-04-10 20:17           ` Stephen Berman [this message]
2024-04-10 23:14             ` [External] : " Drew Adams
2024-04-10 23:16               ` Heime

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87seztht1f.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=i@fuzy.me \
    --cc=joostkremers@fastmail.fm \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).