unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Printing documentation string of another function
@ 2024-04-10 12:48 Heime
  2024-04-10 12:55 ` Zhengyi Fu
  0 siblings, 1 reply; 10+ messages in thread
From: Heime @ 2024-04-10 12:48 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

Is it possible to have a function that prints the documentation string 
of another function ?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Printing documentation string of another function
  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
  0 siblings, 2 replies; 10+ messages in thread
From: Zhengyi Fu @ 2024-04-10 12:55 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor


> 在 2024年4月10日,下午8:49,Heime <heimeborgia@protonmail.com> 写道:
> 
> Is it possible to have a function that prints the documentation string
> of another function ?
> 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Accessing-Documentation.html 
I recommend you read the manual before asking here.
> 




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Printing documentation string of another function
  2024-04-10 12:55 ` Zhengyi Fu
@ 2024-04-10 13:20   ` Heime
  2024-04-10 13:22   ` Joost Kremers
  1 sibling, 0 replies; 10+ messages in thread
From: Heime @ 2024-04-10 13:20 UTC (permalink / raw)
  To: Zhengyi Fu; +Cc: Heime via Users list for the GNU Emacs text editor

On Thursday, April 11th, 2024 at 12:55 AM, Zhengyi Fu <i@fuzy.me> wrote:

> > 在 2024年4月10日,下午8:49,Heime heimeborgia@protonmail.com 写道:
> > 
> > Is it possible to have a function that prints the documentation string
> > of another function ?
> 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Accessing-Documentation.html
> I recommend you read the manual before asking here.

It is not very clear. Would that be 

documentation function &optional verbatim






^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Printing documentation string of another function
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Joost Kremers @ 2024-04-10 13:22 UTC (permalink / raw)
  To: Zhengyi Fu; +Cc: Heime, Heime via Users list for the GNU Emacs text editor

On Wed, Apr 10 2024, Zhengyi Fu wrote:
>> 在 2024年4月10日,下午8:49,Heime <heimeborgia@protonmail.com> 写道:
>> 
>> Is it possible to have a function that prints the documentation string
>> of another function ?
>> 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Accessing-Documentation.html
> I recommend you read the manual before asking here.

I would also recommend using Emacs' own documentation system. `C-h i` starts the
info system. Press `h` for an introduction on using it.

-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Printing documentation string of another function
  2024-04-10 13:22   ` Joost Kremers
@ 2024-04-10 17:17     ` Heime
  2024-04-10 19:36       ` Stephen Berman
  0 siblings, 1 reply; 10+ messages in thread
From: Heime @ 2024-04-10 17:17 UTC (permalink / raw)
  To: Joost Kremers
  Cc: Zhengyi Fu, Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

On Thursday, April 11th, 2024 at 1:22 AM, Joost Kremers <joostkremers@fastmail.fm> wrote:

> On Wed, Apr 10 2024, Zhengyi Fu wrote:
> 
> > > 在 2024年4月10日,下午8:49,Heime heimeborgia@protonmail.com 写道:
> > > 
> > > Is it possible to have a function that prints the documentation string
> > > of another function ?
> > 
> > https://www.gnu.org/software/emacs/manual/html_node/elisp/Accessing-Documentation.html
> > I recommend you read the manual before asking here.
> 
> 
> I would also recommend using Emacs' own documentation system. `C-h i` starts the
> info system. Press `h` for an introduction on using it.
> 
> --
> Joost Kremers
> Life has its moments

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




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Printing documentation string of another function
  2024-04-10 17:17     ` Heime
@ 2024-04-10 19:36       ` Stephen Berman
  2024-04-10 20:09         ` Heime
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Berman @ 2024-04-10 19:36 UTC (permalink / raw)
  To: Heime
  Cc: Joost Kremers, Zhengyi Fu,
	Heime via Users list for the GNU Emacs text editor

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Printing documentation string of another function
  2024-04-10 19:36       ` Stephen Berman
@ 2024-04-10 20:09         ` Heime
  2024-04-10 20:17           ` Stephen Berman
  0 siblings, 1 reply; 10+ messages in thread
From: Heime @ 2024-04-10 20:09 UTC (permalink / raw)
  To: Stephen Berman
  Cc: Joost Kremers, Zhengyi Fu,
	Heime via Users list for the GNU Emacs text editor

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Printing documentation string of another function
  2024-04-10 20:09         ` Heime
@ 2024-04-10 20:17           ` Stephen Berman
  2024-04-10 23:14             ` [External] : " Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Berman @ 2024-04-10 20:17 UTC (permalink / raw)
  To: Heime
  Cc: Joost Kremers, Zhengyi Fu,
	Heime via Users list for the GNU Emacs text editor

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [External] : Re: Printing documentation string of another function
  2024-04-10 20:17           ` Stephen Berman
@ 2024-04-10 23:14             ` Drew Adams
  2024-04-10 23:16               ` Heime
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2024-04-10 23:14 UTC (permalink / raw)
  To: Stephen Berman, Heime
  Cc: Joost Kremers, Zhengyi Fu,
	Heime via Users list for the GNU Emacs text editor

> > 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)
...
>   (describe-function (pcase seltr
> 	 ("Greek" 'avus-greek)
> 	 ("Flokki" 'avus-flokki))))

Which OP could likely have figured out
from doing `C-h k C-h f'.

Learn to fish - ask Emacs, she wants
to help.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [External] : Re: Printing documentation string of another function
  2024-04-10 23:14             ` [External] : " Drew Adams
@ 2024-04-10 23:16               ` Heime
  0 siblings, 0 replies; 10+ messages in thread
From: Heime @ 2024-04-10 23:16 UTC (permalink / raw)
  To: Drew Adams
  Cc: Stephen Berman, Joost Kremers, Zhengyi Fu,
	Heime via Users list for the GNU Emacs text editor

On Thursday, April 11th, 2024 at 11:14 AM, Drew Adams <drew.adams@oracle.com> wrote:

> > > 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)
> 
> ...
> 
> > (describe-function (pcase seltr
> > ("Greek" 'avus-greek)
> > ("Flokki" 'avus-flokki))))
> 
> 
> Which OP could likely have figured out
> from doing `C-h k C-h f'.
> 
> Learn to fish - ask Emacs, she wants
> to help.

Yes, I figured it was calling describe-function.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-04-10 23:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-04-10 23:14             ` [External] : " Drew Adams
2024-04-10 23:16               ` Heime

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