* Interactive function
@ 2022-10-10 13:24 uzibalqa
2022-10-10 13:43 ` thibaut.verron
0 siblings, 1 reply; 8+ messages in thread
From: uzibalqa @ 2022-10-10 13:24 UTC (permalink / raw)
To: uzibalqa via Users list for the GNU Emacs text editor
I have the following function that prints some information about Emacs Init.
The messages for the user are included in the function documentation part.
Thusly, I would like that when the user calls "M-x emacs-init", I show the
docstring. How can I implement such feature in the body of the function to
call the docstring?
(defun emacs-init ()
"TODO.
Emacs packages write their caches, histories, etc. into ~/.emacs.d/.
See directory '.emacs.d' in directory
${HOME}/xepty/"
(interactive)
(message "See C-h f emacs-init") )
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function
2022-10-10 13:24 Interactive function uzibalqa
@ 2022-10-10 13:43 ` thibaut.verron
2022-10-10 14:23 ` uzibalqa
2022-10-10 23:42 ` Emanuel Berg
0 siblings, 2 replies; 8+ messages in thread
From: thibaut.verron @ 2022-10-10 13:43 UTC (permalink / raw)
To: help-gnu-emacs
Something like that?
(defun function (args)
"Docstring"
(describe-function #'function))
You should probably not show this to the compiler though.
On 10/10/2022 15:24, uzibalqa <uzibalqa@proton.me> wrote:
> I have the following function that prints some information about Emacs Init.
> The messages for the user are included in the function documentation part.
> Thusly, I would like that when the user calls "M-x emacs-init", I show the
> docstring. How can I implement such feature in the body of the function to
> call the docstring?
>
>
> (defun emacs-init ()
>
> "TODO.
>
> Emacs packages write their caches, histories, etc. into ~/.emacs.d/.
>
> See directory '.emacs.d' in directory
>
> ${HOME}/xepty/"
>
> (interactive)
>
> (message "See C-h f emacs-init") )
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function
2022-10-10 13:43 ` thibaut.verron
@ 2022-10-10 14:23 ` uzibalqa
2022-10-10 14:46 ` Thibaut Verron
2022-10-10 23:42 ` Emanuel Berg
1 sibling, 1 reply; 8+ messages in thread
From: uzibalqa @ 2022-10-10 14:23 UTC (permalink / raw)
To: thibaut.verron; +Cc: help-gnu-emacs
------- Original Message -------
On Monday, October 10th, 2022 at 1:43 PM, <thibaut.verron@gmail.com> wrote:
> Something like that?
>
> (defun function (args)
> "Docstring"
> (describe-function #'function))
>
> You should probably not show this to the compiler though.
I do not understand the "not show to the compiler" part.
> On 10/10/2022 15:24, uzibalqa uzibalqa@proton.me wrote:
>
> > I have the following function that prints some information about Emacs Init.
> > The messages for the user are included in the function documentation part.
> > Thusly, I would like that when the user calls "M-x emacs-init", I show the
> > docstring. How can I implement such feature in the body of the function to
> > call the docstring?
> >
> > (defun emacs-init ()
> >
> > "TODO.
> >
> > Emacs packages write their caches, histories, etc. into ~/.emacs.d/.
> >
> > See directory '.emacs.d' in directory
> >
> > ${HOME}/xepty/"
> >
> > (interactive)
> >
> > (message "See C-h f emacs-init") )
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function
2022-10-10 14:23 ` uzibalqa
@ 2022-10-10 14:46 ` Thibaut Verron
2022-10-10 15:46 ` uzibalqa
2022-10-10 23:54 ` Emanuel Berg
0 siblings, 2 replies; 8+ messages in thread
From: Thibaut Verron @ 2022-10-10 14:46 UTC (permalink / raw)
To: uzibalqa; +Cc: help-gnu-emacs
On 10/10/2022 16:23, uzibalqa wrote:
> ------- Original Message -------
> On Monday, October 10th, 2022 at 1:43 PM, <thibaut.verron@gmail.com> wrote:
>
>
>> Something like that?
>>
>> (defun function (args)
>> "Docstring"
>> (describe-function #'function))
>>
>> You should probably not show this to the compiler though.
> I do not understand the "not show to the compiler" part.
I was thinking that the compiler might take offense at the use of the
function before it is properly defined. But on second thought, it
shouldn't really be different from resolving a recursive call.
>
>
>> On 10/10/2022 15:24, uzibalqa uzibalqa@proton.me wrote:
>>
>>> I have the following function that prints some information about Emacs Init.
>>> The messages for the user are included in the function documentation part.
>>> Thusly, I would like that when the user calls "M-x emacs-init", I show the
>>> docstring. How can I implement such feature in the body of the function to
>>> call the docstring?
>>>
>>> (defun emacs-init ()
>>>
>>> "TODO.
>>>
>>> Emacs packages write their caches, histories, etc. into ~/.emacs.d/.
>>>
>>> See directory '.emacs.d' in directory
>>>
>>> ${HOME}/xepty/"
>>>
>>> (interactive)
>>>
>>> (message "See C-h f emacs-init") )
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function
2022-10-10 14:46 ` Thibaut Verron
@ 2022-10-10 15:46 ` uzibalqa
2022-10-10 23:54 ` Emanuel Berg
1 sibling, 0 replies; 8+ messages in thread
From: uzibalqa @ 2022-10-10 15:46 UTC (permalink / raw)
To: Thibaut Verron; +Cc: help-gnu-emacs
------- Original Message -------
On Monday, October 10th, 2022 at 2:46 PM, Thibaut Verron <thibaut.verron@gmail.com> wrote:
> On 10/10/2022 16:23, uzibalqa wrote:
>
> > ------- Original Message -------
> > On Monday, October 10th, 2022 at 1:43 PM, thibaut.verron@gmail.com wrote:
> >
> > > Something like that?
> > >
> > > (defun function (args)
> > > "Docstring"
> > > (describe-function #'function))
> > >
> > > You should probably not show this to the compiler though.
> > > I do not understand the "not show to the compiler" part.
>
>
> I was thinking that the compiler might take offense at the use of the
> function before it is properly defined. But on second thought, it
> shouldn't really be different from resolving a recursive call.
Seems to be working well when I use it.
> > > On 10/10/2022 15:24, uzibalqa uzibalqa@proton.me wrote:
> > >
> > > > I have the following function that prints some information about Emacs Init.
> > > > The messages for the user are included in the function documentation part.
> > > > Thusly, I would like that when the user calls "M-x emacs-init", I show the
> > > > docstring. How can I implement such feature in the body of the function to
> > > > call the docstring?
> > > >
> > > > (defun emacs-init ()
> > > >
> > > > "TODO.
> > > >
> > > > Emacs packages write their caches, histories, etc. into ~/.emacs.d/.
> > > >
> > > > See directory '.emacs.d' in directory
> > > >
> > > > ${HOME}/xepty/"
> > > >
> > > > (interactive)
> > > >
> > > > (message "See C-h f emacs-init") )
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function
2022-10-10 13:43 ` thibaut.verron
2022-10-10 14:23 ` uzibalqa
@ 2022-10-10 23:42 ` Emanuel Berg
1 sibling, 0 replies; 8+ messages in thread
From: Emanuel Berg @ 2022-10-10 23:42 UTC (permalink / raw)
To: help-gnu-emacs
thibaut.verron wrote:
> (defun function (args)
Uhm, you are aware `function' is already a function ..
> #'function
Interesting, and it would seem so BTW :^)
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function
2022-10-10 14:46 ` Thibaut Verron
2022-10-10 15:46 ` uzibalqa
@ 2022-10-10 23:54 ` Emanuel Berg
2022-10-11 15:01 ` Michael Heerdegen
1 sibling, 1 reply; 8+ messages in thread
From: Emanuel Berg @ 2022-10-10 23:54 UTC (permalink / raw)
To: help-gnu-emacs
Thibaut Verron wrote:
> I was thinking that the compiler might take offense at the
> use of the function before it is properly defined.
Before evaluating your function, do
(describe-function #'function)
But it seems you cannot do
(describe-function #'#')
However
(describe-function (function function))
is fine :)
> But on second thought, it shouldn't really be different from
> resolving a recursive call.
Yes:
(defun describe-me ()
(describe-function #'describe-me) )
(defun recurse-you (n)
(if (not (zerop n))
(+ n (recurse-you (1- n)))
n) )
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function
2022-10-10 23:54 ` Emanuel Berg
@ 2022-10-11 15:01 ` Michael Heerdegen
0 siblings, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2022-10-11 15:01 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg <incal@dataswamp.org> writes:
> But it seems you cannot do
>
> (describe-function #'#')
So to say, the reader macro #' requires an argument (i.e. the following
form), and the inner one above doesn't provide one, so you get a read
error.
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-10-11 15:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-10 13:24 Interactive function uzibalqa
2022-10-10 13:43 ` thibaut.verron
2022-10-10 14:23 ` uzibalqa
2022-10-10 14:46 ` Thibaut Verron
2022-10-10 15:46 ` uzibalqa
2022-10-10 23:54 ` Emanuel Berg
2022-10-11 15:01 ` Michael Heerdegen
2022-10-10 23:42 ` Emanuel Berg
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).