# HG changeset patch # User Glenn Morris # Date 1255675704 0 # Node ID 127b35cd2de78cd832f1d0248acd3d14652f6c24 # Parent 7cea65998c1f5da164865f01a2ef790d38dfa5eb (define-obsolete-variable-alias): Doc fix. Maybe copy some custom properties from old to new name. (Bug#4706) diff -r 7cea65998c1f -r 127b35cd2de7 lisp/ChangeLog --- a/lisp/ChangeLog Fri Oct 16 05:03:56 2009 +0000 +++ b/lisp/ChangeLog Fri Oct 16 06:48:24 2009 +0000 @@ -1,3 +1,8 @@ +2009-10-16 Glenn Morris + + * emacs-lisp/byte-run.el (define-obsolete-variable-alias): Doc fix. + Maybe copy some custom properties from old to new name. (Bug#4706) + 2009-10-16 Juanma Barranquero * subr.el (error, sit-for, start-process-shell-command) diff -r 7cea65998c1f -r 127b35cd2de7 lisp/emacs-lisp/byte-run.el --- a/lisp/emacs-lisp/byte-run.el Fri Oct 16 05:03:56 2009 +0000 +++ b/lisp/emacs-lisp/byte-run.el Fri Oct 16 06:48:24 2009 +0000 @@ -175,28 +175,32 @@ (defmacro define-obsolete-variable-alias (obsolete-name current-name &optional when docstring) "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. - -\(define-obsolete-variable-alias 'old-var 'new-var \"22.1\" \"old-var's doc.\") - -is equivalent to the following two lines of code: - -\(defvaralias 'old-var 'new-var \"old-var's doc.\") -\(make-obsolete-variable 'old-var 'new-var \"22.1\") +This uses `defvaralias' and `make-obsolete-variable' (which see). +See the Info node `(elisp)Variable Aliases' for more details. If CURRENT-NAME is a defcustom (more generally, any variable where OBSOLETE-NAME may be set, e.g. in a .emacs file, before the alias is defined), then the define-obsolete-variable-alias -statement should be placed before the defcustom. This is so that -any user customizations are applied before the defcustom tries to -initialize the variable (this is due to the way `defvaralias' works). -Exceptions to this rule occur for define-obsolete-variable-alias -statements that are autoloaded, or in files dumped with Emacs. +statement should be evaluated before the defcustom, if user +customizations are to be respected. The simplest way to achieve +this is to place the alias statement before the defcustom (this +is not necessary for aliases that are autoloaded, or in files +dumped with Emacs). This is so that any user customizations are +applied before the defcustom tries to initialize the +variable (this is due to the way `defvaralias' works). -See the docstrings of `defvaralias' and `make-obsolete-variable' or -Info node `(elisp)Variable Aliases' for more details." +For the benefit of `custom-set-variables', if OBSOLETE-NAME has +any of the following properties, they are copied to +CURRENT-NAME, if it does not already have them: +'saved-value, 'saved-variable-comment." (declare (doc-string 4)) `(progn (defvaralias ,obsolete-name ,current-name ,docstring) + ;; See Bug#4706. + (mapc (lambda (prop) (or (get ,current-name prop) + (put ,current-name prop + (get ,obsolete-name prop)))) + '(saved-value saved-variable-comment)) (make-obsolete-variable ,obsolete-name ,current-name ,when))) (set-advertised-calling-convention ;; New code should always provide the `when' argument.