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.
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 (evenp (length pairs))
(error "PAIRS must have an even number of variable/value members"))
(let ((vars nil)
(tmp pairs))
(while tmp (push (car tmp) vars) (setq tmp (cddr tmp)))
(setq vars (nreverse vars))
`(prog1
(buffer-local-set-state--get ',vars)
(setq-local ,@pairs))))