Function: defvar-local

defvar-local is a macro defined in subr.el.gz.

Signature

(defvar-local VAR VAL &optional DOCSTRING)

Documentation

Define VAR as a buffer-local variable with default value VAL.

Like defvar but additionally marks the variable as being automatically buffer-local wherever it is set.

Probably introduced at or before Emacs version 24.3.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defmacro defvar-local (var val &optional docstring)
  "Define VAR as a buffer-local variable with default value VAL.
Like `defvar' but additionally marks the variable as being automatically
buffer-local wherever it is set."
  (declare (debug defvar) (doc-string 3))
  ;; Can't use backquote here, it's too early in the bootstrap.
  (list 'progn (list 'defvar var val docstring)
        (list 'make-variable-buffer-local (list 'quote var))))