* define-minor-mode: what's the purpose of the BODY argument?
@ 2012-08-16 10:49 Raffaele Ricciardi
2012-08-16 14:05 ` Drew Adams
[not found] ` <mailman.7109.1345125960.855.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 5+ messages in thread
From: Raffaele Ricciardi @ 2012-08-16 10:49 UTC (permalink / raw)
To: help-gnu-emacs
Hello there,
the documentation of `define-minor-mode' begins with:
— Macro: define-minor-mode mode doc [init-value [lighter [keymap]]]
keyword-args... body...
Then it continues with documenting what the purpose of each argument is,
but it
fails to do so for the BODY argument. So, what's the purpose of that
argument?
Is it code to be run every time the mode is activated or deactivated,
and such
code can check `prefix-argument' to determine whether it should activate or
deactivate itself?
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: define-minor-mode: what's the purpose of the BODY argument?
2012-08-16 10:49 define-minor-mode: what's the purpose of the BODY argument? Raffaele Ricciardi
@ 2012-08-16 14:05 ` Drew Adams
[not found] ` <mailman.7109.1345125960.855.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 5+ messages in thread
From: Drew Adams @ 2012-08-16 14:05 UTC (permalink / raw)
To: 'Raffaele Ricciardi', help-gnu-emacs
> the documentation of `define-minor-mode' begins with:
>
> Macro: define-minor-mode mode doc [init-value [lighter [keymap]]]
> keyword-args... body...
>
> Then it continues with documenting what the purpose of each
> argument is, but it fails to do so for the BODY argument. So,
> what's the purpose of that argument? Is it...?
You should not have to guess.
To find out the answer, file a doc bug report. ;-)
Each of the arguments should be described in the doc string.
M-x report-emacs-bug
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: define-minor-mode: what's the purpose of the BODY argument?
[not found] ` <mailman.7109.1345125960.855.help-gnu-emacs@gnu.org>
@ 2012-08-16 17:23 ` Raffaele Ricciardi
2012-08-16 21:32 ` Raffaele Ricciardi
0 siblings, 1 reply; 5+ messages in thread
From: Raffaele Ricciardi @ 2012-08-16 17:23 UTC (permalink / raw)
To: help-gnu-emacs
On 08/16/2012 03:05 PM, Drew Adams wrote:
>> the documentation of `define-minor-mode' begins with:
>>
>> Macro: define-minor-mode mode doc [init-value [lighter [keymap]]]
>> keyword-args... body...
>>
>> Then it continues with documenting what the purpose of each
>> argument is, but it fails to do so for the BODY argument. So,
>> what's the purpose of that argument? Is it...?
>
> You should not have to guess.
>
> To find out the answer, file a doc bug report. ;-)
> Each of the arguments should be described in the doc string.
>
> M-x report-emacs-bug
>
>
Well, I discovered that the argument is indeed documented, only not as
prominently as the others. Therefore I missed it, also because arguments in
Info mode are not highlighted the way I'm used to in Help mode. I
apologize for
the inconvenience.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: define-minor-mode: what's the purpose of the BODY argument?
2012-08-16 17:23 ` Raffaele Ricciardi
@ 2012-08-16 21:32 ` Raffaele Ricciardi
2012-08-24 22:24 ` Drew Adams
0 siblings, 1 reply; 5+ messages in thread
From: Raffaele Ricciardi @ 2012-08-16 21:32 UTC (permalink / raw)
To: help-gnu-emacs
On 08/16/2012 06:23 PM, Raffaele Ricciardi wrote:
> Well, I discovered that the argument is indeed documented, only not as
> prominently as the others. Therefore I missed it, also because
> arguments in
> Info mode are not highlighted the way I'm used to in Help mode. I
> apologize for
> the inconvenience.
And to avoid cutting a sorry figure like this one in the future, I've
written a
snippet of code to highlight arguments in Info mode, too, and I'm
attaching it.
Arguments are empirically identified as symbols of two or more uppercase
letters, digits or dashes, starting with a letter.
I would have preferred using the `help-argument-name' face, but on my
installation this face misbehaves (I've filed a bug report), so I'm using
`font-lock-comment-face'.
(defun rr-Info-mode-highlight-argument-names ()
"Highlight argument names as they are highlighted in Help mode."
;; To avoid highlighting uppercase single letters in the text, highlight
;; only symbols more than one character long.
(font-lock-add-keywords nil
'(("\\_<[A-Z][-A-Z[:digit:]]+\\_>"
. font-lock-comment-face))))
(add-hook 'Info-mode-hook #'rr-Info-mode-highlight-argument-names)
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: define-minor-mode: what's the purpose of the BODY argument?
2012-08-16 21:32 ` Raffaele Ricciardi
@ 2012-08-24 22:24 ` Drew Adams
0 siblings, 0 replies; 5+ messages in thread
From: Drew Adams @ 2012-08-24 22:24 UTC (permalink / raw)
To: 'Raffaele Ricciardi', help-gnu-emacs
FYI - Info+ fontifies entries for reference items (functions, macros, commands,
special forms, constants, options, other variables), and that includes their
parameters, even those on continuation lines.
http://www.emacswiki.org/emacs/InfoPlus
> I've written a snippet of code to highlight arguments in Info
> mode, too, and I'm attaching it. Arguments are empirically
> identified as symbols of two or more uppercase
> letters, digits or dashes, starting with a letter.
>
> (defun rr-Info-mode-highlight-argument-names ()
> "Highlight argument names as they are highlighted in Help mode."
> (font-lock-add-keywords nil
> '(("\\_<[A-Z][-A-Z[:digit:]]+\\_>"
> . font-lock-comment-face))))
> (add-hook 'Info-mode-hook #'rr-Info-mode-highlight-argument-names)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-24 22:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 10:49 define-minor-mode: what's the purpose of the BODY argument? Raffaele Ricciardi
2012-08-16 14:05 ` Drew Adams
[not found] ` <mailman.7109.1345125960.855.help-gnu-emacs@gnu.org>
2012-08-16 17:23 ` Raffaele Ricciardi
2012-08-16 21:32 ` Raffaele Ricciardi
2012-08-24 22:24 ` Drew Adams
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).