diff options
| author | Glenn Morris | 2009-10-16 06:48:24 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-10-16 06:48:24 +0000 |
| commit | 850bfd0444b2bae17a99e0d026af8d507dd69cb0 (patch) | |
| tree | af587503f1b7ab0883b3498129ea43a5545b025f | |
| parent | f3ed9aca2816b6488ad2ea0733adfa22079dad57 (diff) | |
| download | emacs-850bfd0444b2bae17a99e0d026af8d507dd69cb0.tar.gz emacs-850bfd0444b2bae17a99e0d026af8d507dd69cb0.zip | |
(define-obsolete-variable-alias): Doc fix.
Maybe copy some custom properties from old to new name. (Bug#4706)
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/byte-run.el | 34 |
2 files changed, 24 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d48b95612b3..883285b20c5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2009-10-16 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * emacs-lisp/byte-run.el (define-obsolete-variable-alias): Doc fix. | ||
| 4 | Maybe copy some custom properties from old to new name. (Bug#4706) | ||
| 5 | |||
| 1 | 2009-10-16 Juanma Barranquero <lekktu@gmail.com> | 6 | 2009-10-16 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | * subr.el (error, sit-for, start-process-shell-command) | 8 | * subr.el (error, sit-for, start-process-shell-command) |
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 5c4eeae0cde..7b0faec655c 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el | |||
| @@ -175,28 +175,32 @@ was first made obsolete, for example a date or a release number." | |||
| 175 | (defmacro define-obsolete-variable-alias (obsolete-name current-name | 175 | (defmacro define-obsolete-variable-alias (obsolete-name current-name |
| 176 | &optional when docstring) | 176 | &optional when docstring) |
| 177 | "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. | 177 | "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. |
| 178 | 178 | This uses `defvaralias' and `make-obsolete-variable' (which see). | |
| 179 | \(define-obsolete-variable-alias 'old-var 'new-var \"22.1\" \"old-var's doc.\") | 179 | See the Info node `(elisp)Variable Aliases' for more details. |
| 180 | |||
| 181 | is equivalent to the following two lines of code: | ||
| 182 | |||
| 183 | \(defvaralias 'old-var 'new-var \"old-var's doc.\") | ||
| 184 | \(make-obsolete-variable 'old-var 'new-var \"22.1\") | ||
| 185 | 180 | ||
| 186 | If CURRENT-NAME is a defcustom (more generally, any variable | 181 | If CURRENT-NAME is a defcustom (more generally, any variable |
| 187 | where OBSOLETE-NAME may be set, e.g. in a .emacs file, before the | 182 | where OBSOLETE-NAME may be set, e.g. in a .emacs file, before the |
| 188 | alias is defined), then the define-obsolete-variable-alias | 183 | alias is defined), then the define-obsolete-variable-alias |
| 189 | statement should be placed before the defcustom. This is so that | 184 | statement should be evaluated before the defcustom, if user |
| 190 | any user customizations are applied before the defcustom tries to | 185 | customizations are to be respected. The simplest way to achieve |
| 191 | initialize the variable (this is due to the way `defvaralias' works). | 186 | this is to place the alias statement before the defcustom (this |
| 192 | Exceptions to this rule occur for define-obsolete-variable-alias | 187 | is not necessary for aliases that are autoloaded, or in files |
| 193 | statements that are autoloaded, or in files dumped with Emacs. | 188 | dumped with Emacs). This is so that any user customizations are |
| 194 | 189 | applied before the defcustom tries to initialize the | |
| 195 | See the docstrings of `defvaralias' and `make-obsolete-variable' or | 190 | variable (this is due to the way `defvaralias' works). |
| 196 | Info node `(elisp)Variable Aliases' for more details." | 191 | |
| 192 | For the benefit of `custom-set-variables', if OBSOLETE-NAME has | ||
| 193 | any of the following properties, they are copied to | ||
| 194 | CURRENT-NAME, if it does not already have them: | ||
| 195 | 'saved-value, 'saved-variable-comment." | ||
| 197 | (declare (doc-string 4)) | 196 | (declare (doc-string 4)) |
| 198 | `(progn | 197 | `(progn |
| 199 | (defvaralias ,obsolete-name ,current-name ,docstring) | 198 | (defvaralias ,obsolete-name ,current-name ,docstring) |
| 199 | ;; See Bug#4706. | ||
| 200 | (mapc (lambda (prop) (or (get ,current-name prop) | ||
| 201 | (put ,current-name prop | ||
| 202 | (get ,obsolete-name prop)))) | ||
| 203 | '(saved-value saved-variable-comment)) | ||
| 200 | (make-obsolete-variable ,obsolete-name ,current-name ,when))) | 204 | (make-obsolete-variable ,obsolete-name ,current-name ,when))) |
| 201 | (set-advertised-calling-convention | 205 | (set-advertised-calling-convention |
| 202 | ;; New code should always provide the `when' argument. | 206 | ;; New code should always provide the `when' argument. |