From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#18059: 24.3.92; defvar and special variables Date: Sun, 11 Feb 2018 00:59:10 +0100 Message-ID: <87y3k0bdm9.fsf@web.de> References: <87ha2c7lxy.fsf@web.de> <87mv0gbq33.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1518307116 16761 195.159.176.226 (10 Feb 2018 23:58:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Feb 2018 23:58:36 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 18059@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 11 00:58:32 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekf1z-0002UF-MV for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 Feb 2018 00:58:07 +0100 Original-Received: from localhost ([::1]:50755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekf41-0003YL-6h for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Feb 2018 19:00:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekf3u-0003XS-3L for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 19:00:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekf3q-0003Uw-Uq for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 19:00:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57744) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ekf3q-0003Ue-Rr for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 19:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ekf3q-0001Nm-Ek for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 19:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Feb 2018 00:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18059 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 18059-submit@debbugs.gnu.org id=B18059.15183071685245 (code B ref 18059); Sun, 11 Feb 2018 00:00:02 +0000 Original-Received: (at 18059) by debbugs.gnu.org; 10 Feb 2018 23:59:28 +0000 Original-Received: from localhost ([127.0.0.1]:37407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekf3I-0001MX-0v for submit@debbugs.gnu.org; Sat, 10 Feb 2018 18:59:28 -0500 Original-Received: from mout.web.de ([212.227.17.11]:41155) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekf3G-0001MK-9e for 18059@debbugs.gnu.org; Sat, 10 Feb 2018 18:59:26 -0500 Original-Received: from drachen.dragon ([188.99.169.170]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MPpE6-1efj6T1ed8-00557U; Sun, 11 Feb 2018 00:59:11 +0100 In-Reply-To: <87mv0gbq33.fsf@users.sourceforge.net> (Noam Postavsky's message of "Sat, 10 Feb 2018 14:29:52 -0500") X-Provags-ID: V03:K0:zkVy50y8VQ9XblUML0t3Lb3D3rP99HVUwu+nJEvi6rNr5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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143118 Archived-At: Hello Noam, thanks for working on this. > +Note that specifying a value, even @code{nil}, marks the variable as > +special permanently. Whereas if @var{value} is omitted then the > +variable is only marked special locally (i.e. within the current file > +or let-block). This can be useful for suppressing byte compilation > +warnings, see @ref{Compiler Errors}. After reading this and thinking about it, I'm confused now what the extent of `defvar' without a specified value is. In the case of a file, does it mean that the variable is considered special for the rest of the file, or for the whole file? And for locally special variables, when you eval #+begin_src emacs-lisp ;; -*- lexical-binding: t -*- (defvar testfun nil) (let ((x 1) f g) (defvar x) (setq testfun (lambda () x))) (funcall testfun) #+end_src you get 1, but OTOH #+begin_src emacs-lisp ;; -*- lexical-binding: t -*- (defvar testfun nil) (progn (defvar x) (let ((x 1) f g) (setq testfun (lambda () x)))) (funcall testfun) #+end_src gives you an error. I don't really see the connection to a `let' block: in the first example, the defvar is in a let block, but the variable is not treated as special in the block. In the second example, it's outside, but the variable is treated as special (though the extent is surely not limited to any `let' block). Michael.