bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4706: customize and aliaes [was Re: bug#4706: 23.1.50; RMAIL mode fa


From: Glenn Morris
Subject: bug#4706: customize and aliaes [was Re: bug#4706: 23.1.50; RMAIL mode fails to read mail first time]
Date: Mon, 12 Oct 2009 15:37:07 -0400
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

retitle 4706 customize and aliases
stop

I could have sworn this was supposed to work, eg:

http://lists.gnu.org/archive/html/emacs-devel/2005-02/msg00543.html
http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg00716.html

Now I can't see that it ever has done. Consider:

foo.el:
(define-obsolete-variable-alias 'oldname 'newname "23.1")
(defcustom newname nil "" :type 'boolean :group 'customize)

~/.emacs:
(custom-set-variables
  '(oldname t))

(It works if you use setq rather than custom in your .emacs.)

Loading .emacs gives 'oldname a 'saved-value property. If foo.el has
not been loaded at this time, there is no way custom can know it
should really be applying this property to 'newname. Later on when
foo.el is loaded, custom-initialize-default checks if 'newname has a
'saved-value property, finds it does not, and so uses the default
value of nil rather than the desired value of t.

It will work if you load foo.el before .emacs, so one solution is to
autoload all defvaraliases that point to defcustoms. However, this is
not a solution for packages not distributed with emacs.

Another solution would be to make defvaralias copy any properties.
At present:

(put 'oldname 'foobar t)
(defvaralias 'oldname 'newname)
(get 'newname 'foobar)    ; -> nil

But changing this doesn't seem right in general, and might break some
existing behaviour.

If custom-initialize-default could somehow check if 'symbol has any
aliases, and if any of these have a 'saved-value property, that would
seem like the right thing to do. But I can't see how to do this. Is
there a "reverse indirect-variable" that lists all aliases of a given
variable?

rmail used to have a slightly complicated workaround for this. I
mistakenly thought it was not needed. Rather than put it back, I'd
prefer to just autoload the alias statements. There are other places
besides rmail that define aliases pointing to defcustoms, so some kind
of general solution is needed.


Any suggestions? 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]