Function: c-lang-defvar
c-lang-defvar is a macro defined in cc-langs.el.gz.
Signature
(c-lang-defvar VAR VAL &optional DOC)
Documentation
Declares the buffer local variable VAR to get the value VAL.
VAL is evaluated and assigned at mode initialization. More
precisely, VAL is evaluated and bound to VAR when the result from
the macro c-init-language-vars is evaluated.
c-lang-const is typically used in VAL to get the right value for the
language being initialized, and such calls will be macro expanded to
the evaluated constant value at compile time.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-langs.el.gz
(defmacro c-lang-defvar (var val &optional doc)
"Declares the buffer local variable VAR to get the value VAL.
VAL is evaluated and assigned at mode initialization. More
precisely, VAL is evaluated and bound to VAR when the result from
the macro `c-init-language-vars' is evaluated.
`c-lang-const' is typically used in VAL to get the right value for the
language being initialized, and such calls will be macro expanded to
the evaluated constant value at compile time."
(declare (indent defun)
(debug (&define name def-form
&optional &or ("quote" symbolp) stringp)))
(when (and (not doc)
(eq (car-safe val) 'c-lang-const)
(eq (nth 1 val) var)
(not (nth 2 val)))
;; Special case: If there's no docstring and the value is a
;; simple (c-lang-const foo) where foo is the same name as VAR
;; then take the docstring from the language constant foo.
(setq doc (get (intern (symbol-name (nth 1 val)) c-lang-constants)
'variable-documentation)))
(or (stringp doc)
(setq doc nil))
(let ((elem (assq var (cdr c-lang-variable-inits))))
(if elem
(setcdr elem (list val doc))
(setcdr c-lang-variable-inits-tail (list (list var val doc)))
(setq c-lang-variable-inits-tail (cdr c-lang-variable-inits-tail))))
;; Return the symbol, like the other def* forms.
`',var)