diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/custom.el | 85 | ||||
| -rw-r--r-- | lisp/emacs-lisp/advice.el | 1 |
3 files changed, 52 insertions, 42 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5a37f858104..900c9625fce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-08-02 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * custom.el (custom-initialize-default, custom-initialize-set) | ||
| 4 | (custom-initialize-reset, custom-initialize-changed): Affect the | ||
| 5 | toplevel-default-value (bug#6275, bug#14586). | ||
| 6 | * emacs-lisp/advice.el (ad-compile-function): Undo previous workaround | ||
| 7 | for bug#6275. | ||
| 8 | |||
| 1 | 2013-08-02 Juanma Barranquero <lekktu@gmail.com> | 9 | 2013-08-02 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 10 | ||
| 3 | * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): | 11 | * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): |
diff --git a/lisp/custom.el b/lisp/custom.el index f2d58084e9e..3db34e4d1fb 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -49,63 +49,66 @@ Users should not set it.") | |||
| 49 | 49 | ||
| 50 | ;;; The `defcustom' Macro. | 50 | ;;; The `defcustom' Macro. |
| 51 | 51 | ||
| 52 | (defun custom-initialize-default (symbol value) | 52 | (defun custom-initialize-default (symbol exp) |
| 53 | "Initialize SYMBOL with VALUE. | 53 | "Initialize SYMBOL with EXP. |
| 54 | This will do nothing if symbol already has a default binding. | 54 | This will do nothing if symbol already has a default binding. |
| 55 | Otherwise, if symbol has a `saved-value' property, it will evaluate | 55 | Otherwise, if symbol has a `saved-value' property, it will evaluate |
| 56 | the car of that and use it as the default binding for symbol. | 56 | the car of that and use it as the default binding for symbol. |
| 57 | Otherwise, VALUE will be evaluated and used as the default binding for | 57 | Otherwise, EXP will be evaluated and used as the default binding for |
| 58 | symbol." | 58 | symbol." |
| 59 | (eval `(defvar ,symbol ,(if (get symbol 'saved-value) | 59 | (eval `(defvar ,symbol ,(let ((sv (get symbol 'saved-value))) |
| 60 | (car (get symbol 'saved-value)) | 60 | (if sv (car sv) exp))))) |
| 61 | value)))) | ||
| 62 | 61 | ||
| 63 | (defun custom-initialize-set (symbol value) | 62 | (defun custom-initialize-set (symbol exp) |
| 64 | "Initialize SYMBOL based on VALUE. | 63 | "Initialize SYMBOL based on EXP. |
| 65 | If the symbol doesn't have a default binding already, | 64 | If the symbol doesn't have a default binding already, |
| 66 | then set it using its `:set' function (or `set-default' if it has none). | 65 | then set it using its `:set' function (or `set-default' if it has none). |
| 67 | The value is either the value in the symbol's `saved-value' property, | 66 | The value is either the value in the symbol's `saved-value' property, |
| 68 | if any, or VALUE." | 67 | if any, or the value of EXP." |
| 69 | (unless (default-boundp symbol) | 68 | (condition-case nil |
| 70 | (funcall (or (get symbol 'custom-set) 'set-default) | 69 | (default-toplevel-value symbol) |
| 71 | symbol | 70 | (error |
| 72 | (eval (if (get symbol 'saved-value) | 71 | (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value) |
| 73 | (car (get symbol 'saved-value)) | 72 | symbol |
| 74 | value))))) | 73 | (eval (let ((sv (get symbol 'saved-value))) |
| 75 | 74 | (if sv (car sv) exp))))))) | |
| 76 | (defun custom-initialize-reset (symbol value) | 75 | |
| 77 | "Initialize SYMBOL based on VALUE. | 76 | (defun custom-initialize-reset (symbol exp) |
| 77 | "Initialize SYMBOL based on EXP. | ||
| 78 | Set the symbol, using its `:set' function (or `set-default' if it has none). | 78 | Set the symbol, using its `:set' function (or `set-default' if it has none). |
| 79 | The value is either the symbol's current value | 79 | The value is either the symbol's current value |
| 80 | (as obtained using the `:get' function), if any, | 80 | (as obtained using the `:get' function), if any, |
| 81 | or the value in the symbol's `saved-value' property if any, | 81 | or the value in the symbol's `saved-value' property if any, |
| 82 | or (last of all) VALUE." | 82 | or (last of all) the value of EXP." |
| 83 | (funcall (or (get symbol 'custom-set) 'set-default) | 83 | (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value) |
| 84 | symbol | 84 | symbol |
| 85 | (cond ((default-boundp symbol) | 85 | (condition-case nil |
| 86 | (funcall (or (get symbol 'custom-get) 'default-value) | 86 | (let ((def (default-toplevel-value symbol)) |
| 87 | symbol)) | 87 | (getter (get symbol 'custom-get))) |
| 88 | ((get symbol 'saved-value) | 88 | (if getter (funcall getter symbol) def)) |
| 89 | (eval (car (get symbol 'saved-value)))) | 89 | (error |
| 90 | (t | 90 | (eval (let ((sv (get symbol 'saved-value))) |
| 91 | (eval value))))) | 91 | (if sv (car sv) exp))))))) |
| 92 | 92 | ||
| 93 | (defun custom-initialize-changed (symbol value) | 93 | (defun custom-initialize-changed (symbol exp) |
| 94 | "Initialize SYMBOL with VALUE. | 94 | "Initialize SYMBOL with EXP. |
| 95 | Like `custom-initialize-reset', but only use the `:set' function if | 95 | Like `custom-initialize-reset', but only use the `:set' function if |
| 96 | not using the standard setting. | 96 | not using the standard setting. |
| 97 | For the standard setting, use `set-default'." | 97 | For the standard setting, use `set-default'." |
| 98 | (cond ((default-boundp symbol) | 98 | (condition-case nil |
| 99 | (funcall (or (get symbol 'custom-set) 'set-default) | 99 | (let ((def (default-toplevel-value symbol))) |
| 100 | symbol | 100 | (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value) |
| 101 | (funcall (or (get symbol 'custom-get) 'default-value) | 101 | symbol |
| 102 | symbol))) | 102 | (let ((getter (get symbol 'custom-get))) |
| 103 | ((get symbol 'saved-value) | 103 | (if getter (funcall getter symbol) def)))) |
| 104 | (funcall (or (get symbol 'custom-set) 'set-default) | 104 | (error |
| 105 | symbol | 105 | (cond |
| 106 | (eval (car (get symbol 'saved-value))))) | 106 | ((get symbol 'saved-value) |
| 107 | (t | 107 | (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value) |
| 108 | (set-default symbol (eval value))))) | 108 | symbol |
| 109 | (eval (car (get symbol 'saved-value))))) | ||
| 110 | (t | ||
| 111 | (set-default symbol (eval exp))))))) | ||
| 109 | 112 | ||
| 110 | (defvar custom-delayed-init-variables nil | 113 | (defvar custom-delayed-init-variables nil |
| 111 | "List of variables whose initialization is pending.") | 114 | "List of variables whose initialization is pending.") |
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 3d03e894534..eb1d63e788b 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el | |||
| @@ -2280,7 +2280,6 @@ For that it has to be fbound with a non-autoload definition." | |||
| 2280 | (defun ad-compile-function (function) | 2280 | (defun ad-compile-function (function) |
| 2281 | "Byte-compile the assembled advice function." | 2281 | "Byte-compile the assembled advice function." |
| 2282 | (require 'bytecomp) | 2282 | (require 'bytecomp) |
| 2283 | (require 'warnings) ;To define warning-suppress-types before we let-bind it. | ||
| 2284 | (let ((byte-compile-warnings byte-compile-warnings) | 2283 | (let ((byte-compile-warnings byte-compile-warnings) |
| 2285 | ;; Don't pop up windows showing byte-compiler warnings. | 2284 | ;; Don't pop up windows showing byte-compiler warnings. |
| 2286 | (warning-suppress-types '((bytecomp)))) | 2285 | (warning-suppress-types '((bytecomp)))) |