Function: buffer-local-set-state

buffer-local-set-state is a macro defined in subr.el.gz.

Signature

(buffer-local-set-state [VARIABLE VALUE]...)

Documentation

Like setq-local, but allow restoring the previous state of locals later.

This macro returns an object that can be passed to buffer-local-restore-state in order to restore the state of the local variables set via this macro.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defmacro buffer-local-set-state (&rest pairs)
  "Like `setq-local', but allow restoring the previous state of locals later.
This macro returns an object that can be passed to `buffer-local-restore-state'
in order to restore the state of the local variables set via this macro.

\(fn [VARIABLE VALUE]...)"
  (declare (debug setq))
  (unless (zerop (mod (length pairs) 2))
    (error "PAIRS must have an even number of variable/value members"))
  `(prog1
       (buffer-local-set-state--get ',pairs)
     (setq-local ,@pairs)))