From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.devel Subject: Re: Warnings about keymaps Date: Mon, 14 Sep 2009 22:45:19 -0400 Message-ID: References: <83ocph26p7.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252982752 26047 80.91.229.12 (15 Sep 2009 02:45:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Sep 2009 02:45:52 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 15 04:45:45 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MnO36-0006p5-S6 for ged-emacs-devel@m.gmane.org; Tue, 15 Sep 2009 04:45:45 +0200 Original-Received: from localhost ([127.0.0.1]:51771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnO36-0003nW-73 for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2009 22:45:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnO2m-0003ae-KE for emacs-devel@gnu.org; Mon, 14 Sep 2009 22:45:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnO2i-0003XA-P9 for emacs-devel@gnu.org; Mon, 14 Sep 2009 22:45:24 -0400 Original-Received: from [199.232.76.173] (port=46428 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnO2i-0003X5-Ir for emacs-devel@gnu.org; Mon, 14 Sep 2009 22:45:20 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:35822) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MnO2i-0002wl-7D for emacs-devel@gnu.org; Mon, 14 Sep 2009 22:45:20 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1MnO2h-0003tY-UY; Mon, 14 Sep 2009 22:45:19 -0400 X-Spook: AIMSX Compsec JPL Ft. Bragg BROMURE Gazprom Ruby Ridge X-Ran: c3SkTIdz-KiGWE4"wl!Uh9Q52!Qzh#1t8U List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115330 Archived-At: 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)))