[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Warnings about keymaps
From: |
Glenn Morris |
Subject: |
Re: Warnings about keymaps |
Date: |
Mon, 14 Sep 2009 22:45:19 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
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)))
- Warnings about keymaps, Eli Zaretskii, 2009/09/11
- Re: Warnings about keymaps, Glenn Morris, 2009/09/11
- Re: Warnings about keymaps, Stefan Monnier, 2009/09/11
- Re: Warnings about keymaps, Glenn Morris, 2009/09/14
- Re: Warnings about keymaps, Stefan Monnier, 2009/09/14
- Re: Warnings about keymaps,
Glenn Morris <=
- Re: Warnings about keymaps, Stefan Monnier, 2009/09/15
- Re: Warnings about keymaps, Glenn Morris, 2009/09/17
- Re: Warnings about keymaps, Stefan Monnier, 2009/09/17
- Re: Warnings about keymaps, Glenn Morris, 2009/09/18
- Re: Warnings about keymaps, Stephen J. Turnbull, 2009/09/18
- Re: Warnings about keymaps, Stefan Monnier, 2009/09/18
- Re: Warnings about keymaps, Richard Stallman, 2009/09/15