unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: Alex Schroeder <alex@emacswiki.org>, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: defvar -> defcustom
Date: Sun, 10 Oct 2004 18:29:15 -0500 (CDT)	[thread overview]
Message-ID: <200410102329.i9ANTFF12752@raven.dms.auburn.edu> (raw)
In-Reply-To: <v9lleevhwk.fsf@marauder.physik.uni-ulm.de> (message from Reiner Steib on Sun, 10 Oct 2004 15:09:47 +0200)

I can not see why we should provide a function to make it convenient
for people to do something they should not be doing: blindly replace
defvar's by defcustom's.  If people are going to try to do that, plenty
of inappropriate defvar's are going to wind up in Custom buffers,
cluttering them and confusing the user.  Moreover, the resulting
defcustom's are likely to be very far from the quality and reliability
of most present defcustom's.

Reiner Steib wrote:

   It cannot figure out the :type for all defvars, but I think 80% could
   be guessed heuristically (e.g. if value is t or nil, take 'boolean).

Do not count on that one.  Plenty of defvar's allow t and/or nil as
defaults or special cases, whereas the "main" type is something else,
often an integer or float, but potentially anything.

The relatively best thing is to do if you are not 100% sure about the
type is to specify _no_ type.  That will give it type 'sexp, which may
not be ideal, but at least is guaranteed not to mess up anything
serious.  I personally always specify `:type 'sexp' explicitly, even
though it is the default anyway, just to show that I _did_ look at it.
So if you did not look at it, it might be better to specify _no_ type,
to avoid giving the impression that you did look at it.

Alex Schroeder wrote:

    Current conventions would also allow to search backwards from the
    defvar to the closest preceding defgroup and just assume it.

That is unfortunately correct.  However it is dangerous to rely on
this convention blindly.  You _definitely_ do not want to rely on it
in files like, say, simple.el, which has defgroup's all over the place
and where anybody can add a new defgroup any day. 

More importantly, it is not just the :type or :group.  People have
come to rely on the fact that Custom does things for them
automatically, that defvar does not do.  Unless you are willing to
make the use of Custom much more unpredictable, you will need to worry
about whether you need one or more :set-after's, :load's, :require's
and so on.  You will need to worry about whether there is a need for a
:set function and if yes, whether the default value of :initialize,
namely `custom-initialize-reset', is really appropriate for that :set
function (it quite often is not).

Missing :set-after's or :require's may mean that when the user saves
his customizations in .emacs, then these customizations will
unpredictably sometimes be respected and sometimes not.  That seems
serious. So these are actually bigger problems than :type (which is
the least important problem, _as long as_ you do _not_ try to guess)
or :group.

Sincerely,

Luc.

  reply	other threads:[~2004-10-10 23:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-09 13:24 defvar -> defcustom Reiner Steib
2004-10-10  4:12 ` Richard Stallman
2004-10-10 13:09   ` Reiner Steib
2004-10-10 23:29     ` Luc Teirlinck [this message]
2004-10-10 13:10   ` Alex Schroeder
2004-10-11  6:17     ` Richard Stallman
2004-10-11  0:58 ` Luc Teirlinck

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=200410102329.i9ANTFF12752@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=alex@emacswiki.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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 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).