Function: so-long-restore-variable

so-long-restore-variable is a byte-compiled function defined in so-long.el.gz.

Signature

(so-long-restore-variable VARIABLE)

Documentation

Restore the remembered value (if any) for VARIABLE.

Source Code

;; Defined in /usr/src/emacs/lisp/so-long.el.gz
(defun so-long-restore-variable (variable)
  "Restore the remembered value (if any) for VARIABLE."
  ;; In the instance where `so-long-mode-revert' has just reverted the major
  ;; mode, note that `kill-all-local-variables' was already called by the
  ;; original mode function, and so these 'overridden' variables may now have
  ;; global rather than buffer-local values (if they are not permanent-local).
  (let* ((remembered (so-long-original variable :exists))
         (originally-local (nth 2 remembered)))
    (if originally-local
        ;; The variable originally existed with a buffer-local value, so we
        ;; restore it as such (even if the global value is a match).
        (set (make-local-variable variable) (cadr remembered))
      ;; Either this variable did not exist initially, or it did not have a
      ;; buffer-local value at that time.  In either case we kill the current
      ;; buffer-local value (if any) in order to restore the original state.
      ;;
      ;; It's possible that the global value has *changed* in the interim; but
      ;; we can't know whether it's best to use the new global value, or retain
      ;; the old value as a buffer-local value, so we keep it simple.
      (kill-local-variable variable))))