From: Glenn Morris <rgm@gnu.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Warnings about keymaps
Date: Mon, 14 Sep 2009 22:45:19 -0400 [thread overview]
Message-ID: <f8zl8xc4e8.fsf@fencepost.gnu.org> (raw)
In-Reply-To: jwvmy4x42yz.fsf-monnier+emacs@gnu.org
Stefan Monnier wrote:
> It could, but it shouldn't complain about assignment to a constant,
> since the defvar will not perform any assignment. I.e. maybe a warning
> is OK, but not the warning we currently get.
How about this? Or perhaps the defvar should just be silently
optimized away, like the default-boundp test seems to be trying to do.
*** bytecomp.el 10 Sep 2009 06:22:30 -0000 2.258
--- bytecomp.el 14 Sep 2009 23:30:56 -0000
***************
*** 4025,4032 ****
(let ((tmp (make-symbol "defconst-tmp-var")))
`(funcall '(lambda (,tmp) (defconst ,var ,tmp))
,value))
;; `defvar' sets `var' only when unbound.
! `(if (not (default-boundp ',var)) (setq-default ,var ,value))))
(when (eq fun 'defconst)
;; This will signal an appropriate error at runtime.
`(eval ',form)))
--- 4036,4046 ----
(let ((tmp (make-symbol "defconst-tmp-var")))
`(funcall '(lambda (,tmp) (defconst ,var ,tmp))
,value))
+ (if (memq var byte-compile-const-variables)
+ (byte-compile-warn "attempt to defvar constant `%s' \
+ has no effect" var)
;; `defvar' sets `var' only when unbound.
! `(if (not (default-boundp ',var)) (setq-default ,var ,value)))))
(when (eq fun 'defconst)
;; This will signal an appropriate error at runtime.
`(eval ',form)))
next prev parent reply other threads:[~2009-09-15 2:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 9:04 Warnings about keymaps Eli Zaretskii
2009-09-11 17:34 ` Glenn Morris
2009-09-11 17:43 ` Stefan Monnier
2009-09-14 19:10 ` Glenn Morris
2009-09-14 21:46 ` Stefan Monnier
2009-09-15 2:45 ` Glenn Morris [this message]
2009-09-15 13:40 ` Stefan Monnier
2009-09-17 7:32 ` Glenn Morris
2009-09-17 14:02 ` Stefan Monnier
2009-09-18 22:25 ` Glenn Morris
2009-09-19 0:04 ` Stephen J. Turnbull
2009-09-19 0:43 ` Stefan Monnier
2009-09-15 15:13 ` Richard Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8zl8xc4e8.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.