]> git.eshelyaron.com Git - emacs.git/commitdiff
Ensure delayed-init custom variables get marked special
authorGlenn Morris <rgm@gnu.org>
Tue, 21 Feb 2017 02:30:40 +0000 (18:30 -0800)
committerGlenn Morris <rgm@gnu.org>
Tue, 21 Feb 2017 02:30:40 +0000 (18:30 -0800)
* lisp/custom.el (custom-reevaluate-setting):
If the variable has never been set, defvar it.  (Bug#25770)

lisp/custom.el

index 70b6839db3d3fbe2d5bac0dc99a5024b6f55f5ec..7eaff450c5d5fbc97a7ef15013128c6a69f6ab25 100644 (file)
@@ -764,9 +764,17 @@ Return non-nil if the `customized-value' property actually changed."
 Use the :set function to do so.  This is useful for customizable options
 that are defined before their standard value can really be computed.
 E.g. dumped variables whose default depends on run-time information."
-  (funcall (or (get symbol 'custom-set) 'set-default)
-          symbol
-          (eval (car (or (get symbol 'saved-value) (get symbol 'standard-value))))))
+  (let ((val (car (or (get symbol 'saved-value)
+                     (get symbol 'standard-value)))))
+    (if (default-boundp symbol)
+       (funcall (or (get symbol 'custom-set) 'set-default) symbol (eval val))
+      ;; If it has never been set at all, defvar it so as to mark it
+      ;; special, etc (bug#25770).  This ignores any :set function,
+      ;; but that is not supposed to be used for initialization anyway.
+      ;; Or we could move this branch to the start, then unconditionally
+      ;; call the custom-set branch.
+      (eval `(defvar ,symbol ,val)))))
+
 
 \f
 ;;; Custom Themes