unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jean Louis <bugs@gnu.support>, Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Does defvar-local has same effect as make-variable-buffer-local?
Date: Sat, 15 May 2021 20:49:55 +0000	[thread overview]
Message-ID: <SA2PR10MB44740F08E1AF70E9E920EC7EF32F9@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <courier.0000000060A02BB5.00006B30@stw1.rcdrun.com>

> (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)))



  reply	other threads:[~2021-05-15 20:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 20:14 Does defvar-local has same effect as make-variable-buffer-local? Jean Louis
2021-05-15 20:49 ` Drew Adams [this message]
2021-05-15 21:01   ` [External] : " Drew Adams
2021-05-15 21:41     ` Jean Louis
2021-05-15 22:16       ` Drew Adams
2021-05-15 22:21         ` Jean Louis
2021-05-16  4:11 ` Eli Zaretskii
2021-05-16  8:09   ` Jean Louis
2021-05-16  8:52     ` Yuri Khan
2021-05-16 16:53       ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-16  8:55     ` Eli Zaretskii
2021-05-16 11:26       ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA2PR10MB44740F08E1AF70E9E920EC7EF32F9@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).