]> git.eshelyaron.com Git - emacs.git/commitdiff
Save and restore default values, and buffer-local setting.
authorKen Raeburn <raeburn@raeburn.org>
Fri, 27 Jan 2017 08:54:36 +0000 (03:54 -0500)
committerKen Raeburn <raeburn@raeburn.org>
Sat, 22 Jul 2017 08:36:20 +0000 (04:36 -0400)
* lisp/loadup.el: When dumping symbol values, write out the default
value, not the current value.  If the variable is marked as
local-if-set, emit a make-variable-buffer-local call.

lisp/loadup.el

index 9c1f86620f551d7bfefe40ecb4605bf42e00c0c4..cb328ddacd8d8cb03e58f632f5e88556269c4aee 100644 (file)
@@ -507,7 +507,7 @@ lost after dumping")))
                    nil
                  (push `(fset ',s ,(macroexp-quote (symbol-function s)))
                        cmds))))
-           (when (and (boundp s)
+           (when (and (default-boundp s)
                       (not (macroexp--const-symbol-p s 'any-value))
                       ;; I think we don't need/want these!
                       (not (memq s '(terminal-frame obarray
@@ -518,7 +518,7 @@ lost after dumping")))
                                      process-environment
                                      command-line-args noninteractive))))
              ;; FIXME: Handle varaliases!
-             (let ((v (symbol-value s)))
+             (let ((v (default-value s)))
                (push `(set-default
                        ',s
                        ,(cond
@@ -539,6 +539,14 @@ lost after dumping")))
                              ol))
                          (v (macroexp-quote v))))
                      cmds)
+               ;; Local variables: make-variable-buffer-local,
+               ;; make-local-variable, and make-variable-frame-local.
+               ;;
+               ;; We may need better introspection facilities to get
+               ;; this right.  For now, assume only the first kind is
+               ;; in use during loadup.
+               (if (local-variable-if-set-p s)
+                   (push `(make-variable-buffer-local ',s) cmds))
                (if (special-variable-p s)
                    ;; A dummy initializer is needed for defvar to mark
                    ;; the variable as special.