unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Keywords supported by define-minor-mode
@ 2016-03-27 15:30 Eli Zaretskii
  2016-03-27 22:38 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2016-03-27 15:30 UTC (permalink / raw)
  To: emacs-devel

I needed today to understand what exactly this does:

  (define-minor-mode midnight-mode
    "Non-nil means run `midnight-hook' at midnight."
    :global t
    :initialize #'custom-initialize-default
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I was astonished to find out that this keyword is not documented
anywhere, neither in the doc string of define-minor-mode, nor in the
manual.  The full list of define-minor-mode's keywords that aren't
documented is this:

  :extra-args
  :set
  :initialize
  :type

Could someone please document these, or at least describe them here in
their own words (so that someone else could update the documentation
accordingly)?  We shouldn't leave such important functionality
undocumented for so long.

TIA



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

* Re: Keywords supported by define-minor-mode
  2016-03-27 15:30 Keywords supported by define-minor-mode Eli Zaretskii
@ 2016-03-27 22:38 ` Stefan Monnier
  2016-03-28 15:23   ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-03-27 22:38 UTC (permalink / raw)
  To: emacs-devel

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

> I needed today to understand what exactly this does:
>   (define-minor-mode midnight-mode
>     "Non-nil means run `midnight-hook' at midnight."
>     :global t
>     :initialize #'custom-initialize-default
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> I was astonished to find out that this keyword is not documented
> anywhere, neither in the doc string of define-minor-mode, nor in the
> manual.  The full list of define-minor-mode's keywords that aren't
> documented is this:

>   :extra-args
>   :set
>   :initialize
>   :type

The latter three are covered by this part of the docstring:

    (other keywords are passed to ‘defcustom’ if
    the minor mode is global)


-- Stefan




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

* Re: Keywords supported by define-minor-mode
  2016-03-27 22:38 ` Stefan Monnier
@ 2016-03-28 15:23   ` Eli Zaretskii
  2016-03-28 15:50     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2016-03-28 15:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Sun, 27 Mar 2016 18:38:38 -0400
> 
> >   :extra-args
> >   :set
> >   :initialize
> >   :type
> 
> The latter three are covered by this part of the docstring:
> 
>     (other keywords are passed to ‘defcustom’ if
>     the minor mode is global)

Yes, but defcustom's documentation is monstrously large, and doesn't
always make sense to someone who just wants to define a minor mode,
easily.

And it still leaves :extra-args.



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

* Re: Keywords supported by define-minor-mode
  2016-03-28 15:23   ` Eli Zaretskii
@ 2016-03-28 15:50     ` Stefan Monnier
  2016-03-28 16:05       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-03-28 15:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

>> >   :extra-args
>> >   :set
>> >   :initialize
>> >   :type
>> 
>> The latter three are covered by this part of the docstring:
>> 
>> (other keywords are passed to ‘defcustom’ if
>> the minor mode is global)

> Yes, but defcustom's documentation is monstrously large, and doesn't
> always make sense to someone who just wants to define a minor mode,
> easily.

Might be true.  But :set, :initialize, and :type are more important for
defcustom than for define-minor-mode, so it'd be more beneficial to
address the issue on defcustom's side than on define-minor-mode side.

> And it still leaves :extra-args.

Yes.


        Stefan



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

* Re: Keywords supported by define-minor-mode
  2016-03-28 15:50     ` Stefan Monnier
@ 2016-03-28 16:05       ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2016-03-28 16:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: emacs-devel@gnu.org
> Date: Mon, 28 Mar 2016 11:50:08 -0400
> 
> >> (other keywords are passed to ‘defcustom’ if
> >> the minor mode is global)
> 
> > Yes, but defcustom's documentation is monstrously large, and doesn't
> > always make sense to someone who just wants to define a minor mode,
> > easily.
> 
> Might be true.  But :set, :initialize, and :type are more important for
> defcustom than for define-minor-mode, so it'd be more beneficial to
> address the issue on defcustom's side than on define-minor-mode side.

All I'm saying is that the doc string of define-minor-mode and the
manual text about it might be more user-friendly if they described
those keywords right there, from the POV of the mode author.



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

end of thread, other threads:[~2016-03-28 16:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-27 15:30 Keywords supported by define-minor-mode Eli Zaretskii
2016-03-27 22:38 ` Stefan Monnier
2016-03-28 15:23   ` Eli Zaretskii
2016-03-28 15:50     ` Stefan Monnier
2016-03-28 16:05       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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