[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Does defvar-local has same effect as make-variable-buff
From: |
Drew Adams |
Subject: |
RE: [External] : Does defvar-local has same effect as make-variable-buffer-local? |
Date: |
Sat, 15 May 2021 20:49:55 +0000 |
> (defvar rcd-current-hash nil)
> (make-variable-buffer-local 'rcd-current-hash)
>
> Is the above totally equivalent to this below?
>
> (defvar-local rcd-current-hash nil)
Ask Emacs.
`C-h f defvar-local', then click link `subr.el':
(defmacro defvar-local (var val &optional docstring)
"..."
;; 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))))
So yes. Without the fiddling for presence in `subr.el'
that would be just:
(defmacro defvar-local (var val &optional docstring)
`(progn (defvar ,var ,val docstring)
(make-variable-buffer-local ',val)))
Re: Does defvar-local has same effect as make-variable-buffer-local?, Eli Zaretskii, 2021/05/16