all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: emacs-devel@gnu.org
Subject: RE: scroll-down with pixel transition
Date: Fri, 21 Apr 2017 08:47:48 -0700 (PDT)	[thread overview]
Message-ID: <1d41a3df-96bc-443c-8a7b-6e0faac46f37@default> (raw)
In-Reply-To: <jwvshl1ubzf.fsf-monnier+gmane.emacs.devel@gnu.org>

> >> Our convention is to end user option names in '-flag', when they
> >> are for users to set.  Let's document that, if it isn't already.

+1

Except that the criterion should not be "when they are for
users to set".  All user options are for users to set.

Perhaps you didn't mean that, but you meant only names of
Boolean options?  (Your later mention of "t-or-nil" suggests
that.)

> > It is not currently documented in code conventions.
> 
> I think it used to be there, but I demoted it to:
> 
>     @item @dots{}-flag
>     The value is significant only as to whether it is @code{nil} or not.
>     Since such variables often end up acquiring more values over time,
>     this convention is not strongly recommended.

That's not a strong reason, IMO.  Lots of things change over
time, and if we want helpful names then we update the names
as needed, accordingly.

Yes, any name is a stake in the sand, and change can erode its
relevance.  But that's not a reason not to use helpful names.
Otherwise, we'd always use names that have no special meaning
(`x', `y', 'z'), to ensure maximum space for possible changes
in meaning.

I understand completely the problem of having a Boolean
option `foo-flag' evolve to an option where certain non-nil
values have special meaning (it is no longer strictly Boolean,
or even perhaps vaguely Boolean).  That's life.  A name change
at that point lets users know about the behavior change.

And in some cases a name change is not needed - when, for
example, all of the non-nil behaviors have a major behavior in
common, and that behavior is the main raison d'etre for the
option.  IOW, if it is still essentially a Boolean, but there
are some additional behavior differences, we might want to
keep the suffix `-flag'.

It's a judgment call.  Here's an example - you might argue
whether `-flag' is appropriate here, but the point is that
non-nil means use WYSIWYG display and nil does not.

(Evolution was not involved here, in fact - it was like
this at the outset.  But it could have evolved to this
from a simple t/nil choice.)

(defcustom icicle-WYSIWYG-Completions-flag "MMMM"
  "*Non-nil means show candidates in `*Completions*' using WYSIWYG.
...the particular non-nil value determines the appearance:
* If t, the candidate displays its meaning: WYSIWYG.
* If a string, the string is propertized and then appended to the
  candidate,  to serve as a color swatch."
  :group 'Icicles-Completions-Display
  :type '(choice
          (string
           :tag "Show candidate plus a WYSIWYG swatch with text..."
           :value "MMMM")
          (const
           :tag "Show candidate itself using WYSIWYG"
           t)
          (const
           :tag "Show candidate as is, with no text properties"
           nil)))

An alternative to such a naming convention, though it too
is imperfect, is to use a test - something like this:

(defun custom-type (variable)
  (and (custom-variable-p variable)
       (get variable 'custom-type)))

In my code (Icicles), there is a command that lets you
toggle Boolean options.  By default, the only options you
can do this to are those whose `custom-type' is `boolean'.
But with a prefix argument you can also toggle options
that are effectively Boolean, such as the one above.

(`nil' is always toggled to `t' by this command, but there
are other commands that cycle specific options among the
possible values or that remember the last non-nil value
and toggle `nil' back to it.)

The point is that in Emacs "Boolean", and so `-flag', can
mean something less strict than `t' vs `nil', and it can
help users if we provide easy ways to use more or less
strict interpretation - au choix - of whether a variable
is Boolean.

> In my experience, using FOO instead of FOO-flag is a better choice.

Does this boil down to the reason given in the doc (above)
that you wrote when you made the policy change?  Or is
there some additional reason?

> Also, many boolean config variables can be introduced as minor
> modes (in which case their name should end in "-mode").

Clearly that's not a relevant argument against the
convention, since `*-mode' minor-mode variables are also
necessarily Boolean.  On the contrary: `*-flag' vs `*-mode'
makes clear that the former is not associated with a minor mode.



  reply	other threads:[~2017-04-21 15:47 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-09 23:49 scroll-down with pixel transition Tak Kunihiro
2017-04-10  5:58 ` Eli Zaretskii
2017-04-10  7:06   ` Tak Kunihiro
2017-04-10  7:42     ` Eli Zaretskii
2017-04-10 22:24       ` Tak Kunihiro
2017-04-11  7:44         ` Eli Zaretskii
2017-04-12 12:13           ` Tak Kunihiro
2017-04-12 12:43             ` Eli Zaretskii
2017-04-13  7:02               ` Tak Kunihiro
2017-04-13  7:21                 ` Eli Zaretskii
2017-04-13  8:12                   ` Tak Kunihiro
2017-04-13  8:20                     ` Eli Zaretskii
2017-04-13  8:40                       ` Tak Kunihiro
2017-04-13  9:04                         ` Eli Zaretskii
2017-04-13  9:22                           ` Tak Kunihiro
2017-04-13 10:24                             ` Eli Zaretskii
2017-04-14  2:40                               ` Tak Kunihiro
2017-04-14  7:37                                 ` Eli Zaretskii
2017-04-14 22:32                                   ` Tak Kunihiro
2017-04-15 10:13                                     ` Eli Zaretskii
2017-04-16  8:35                                       ` Tak Kunihiro
2017-04-16 10:26                                         ` Eli Zaretskii
2017-04-16 12:17                                           ` Tak Kunihiro
2017-04-16 16:51                                             ` Eli Zaretskii
2017-04-16 18:00                                               ` Eli Zaretskii
2017-04-16 23:06                                                 ` Tak Kunihiro
2017-04-17  8:54                                                   ` Eli Zaretskii
2017-04-17 23:15                                                     ` Tak Kunihiro
2017-04-19 12:21                                                       ` Tak Kunihiro
2017-04-19 12:38                                                         ` Kaushal Modi
2017-04-19 12:42                                                           ` Kaushal Modi
2017-04-19 14:44                                                           ` Eli Zaretskii
2017-04-19 15:02                                                             ` Stefan Monnier
2017-04-19 15:07                                                             ` Kaushal Modi
2017-04-19 15:37                                                               ` Eli Zaretskii
2017-04-19 15:49                                                                 ` Kaushal Modi
2017-04-19 16:10                                                                   ` Eli Zaretskii
     [not found]                                                                   ` <<83zifcbcoc.fsf@gnu.org>
2017-04-19 17:33                                                                     ` Drew Adams
2017-04-19 18:21                                                                       ` Lars Brinkhoff
2017-04-21  2:05                                                                   ` Richard Stallman
2017-04-21  6:26                                                                     ` Eli Zaretskii
2017-04-21  8:52                                                                       ` Tak Kunihiro
2017-04-30 12:13                                                                         ` Tak Kunihiro
2017-05-13 17:27                                                                           ` Eli Zaretskii
2017-04-21 13:21                                                                       ` Perry E. Metzger
2017-04-21 13:36                                                                         ` Eli Zaretskii
2017-04-21 14:24                                                                           ` Option name conventions (was Re: scroll-down with pixel transition) Perry E. Metzger
2017-04-21 13:29                                                                       ` scroll-down with pixel transition Stefan Monnier
2017-04-21 15:47                                                                         ` Drew Adams [this message]
2017-04-22  2:31                                                                       ` Richard Stallman
2017-04-22  7:54                                                                         ` Eli Zaretskii
2017-04-23  0:03                                                                           ` Richard Stallman
2017-04-23 12:32                                                                             ` Stefan Monnier
2017-04-25 19:40                                                                               ` Richard Stallman
2017-04-25 20:06                                                                                 ` Dmitry Gutov
2017-04-25 20:38                                                                                   ` Stefan Monnier
2017-04-26 17:16                                                                                     ` Richard Stallman
2017-04-26 17:15                                                                                   ` Richard Stallman
2017-04-15 14:31                                     ` Clément Pit-Claudel
2017-04-15 14:57                                       ` Eli Zaretskii
2017-04-15 15:33                                         ` Clément Pit-Claudel
2017-04-13  8:35                   ` Yuri Khan
2017-04-13  8:57                     ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=1d41a3df-96bc-443c-8a7b-6e0faac46f37@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.