From unknown Sun Jun 22 11:49:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74540: 30.0.91; mention special variables in lexbind Info page Resent-From: Mike Kupfer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2024 00:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74540 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 74540@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173258234128894 (code B ref -1); Tue, 26 Nov 2024 00:53:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Nov 2024 00:52:21 +0000 Received: from localhost ([127.0.0.1]:43368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFjoS-0007Vy-UW for submit@debbugs.gnu.org; Mon, 25 Nov 2024 19:52:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:45668) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFjoR-0007Vq-Cu for submit@debbugs.gnu.org; Mon, 25 Nov 2024 19:52:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFjoO-00048I-9O for bug-gnu-emacs@gnu.org; Mon, 25 Nov 2024 19:52:17 -0500 Received: from shell1.rawbw.com ([198.144.192.42]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFjoM-0005Rv-Eu for bug-gnu-emacs@gnu.org; Mon, 25 Nov 2024 19:52:16 -0500 Received: from alto.camomileplus.org (135-180-174-211.dsl.dynamic.sonic.net [135.180.174.211] (may be forged)) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id 4AQ0q5KL037333 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 25 Nov 2024 16:52:11 -0800 (PST) (envelope-from kupfer@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host 135-180-174-211.dsl.dynamic.sonic.net [135.180.174.211] (may be forged) claimed to be alto.camomileplus.org From: Mike Kupfer X-Mailer: MH-E 8.6+git; nmh 1.8-RC2; Emacs 30.0.91 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Mon, 25 Nov 2024 16:52:05 -0800 Message-ID: <54843.1732582325@alto.camomileplus.org> Received-SPF: pass client-ip=198.144.192.42; envelope-from=kupfer@rawbw.com; helo=shell1.rawbw.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain When I first read up on lexical binding, I didn't realize that I also needed to review the documentation for dynamic binding, so that I could learn about special variables. I think it would be good for the Info page for lexical binding to mention special variables, clarify that the specialness also affects new bindings (not just the initial defvar/defcustom/defconst), and provide a link to the page for dynamic binding (for details about special variables). I've enclosed a draft patch for your consideration. thanks, mike --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=lexbind-special-vars.patch Content-Description: draft patch user: Mike Kupfer date: Mon Nov 25 15:37:53 2024 -0800 files: doc/lispref/variables.texi description: Mention special variables in lexical binding documentation * doc/lispref/variables.texi (Lexical Binding): Briefly mention special variables and their semantics. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1096,7 +1096,7 @@ @end example @noindent -The @code{let} binding defines a lexical environment in which the +Here, the @code{let} binding defines a lexical environment in which the variable @code{x} is locally bound to 0. Within this binding construct, we define a lambda expression which increments @code{x} by one and returns the incremented value. This lambda expression is @@ -1113,6 +1113,12 @@ variable's dynamic binding (i.e., the contents of its symbol's value cell). + Note also that variables may be declared special, in which case they +will use dynamic binding, even for new bindings such as a @code{let} +binding. Depending on how the variable is declared, it can be +special globally, for a single file, or for a portion of a file. +@xref{Dynamic Binding} for details. + @node Dynamic Binding @subsection Dynamic Binding --=-=-=-- From unknown Sun Jun 22 11:49:36 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mike Kupfer Subject: bug#74540: closed (Re: bug#74540: 30.0.91; mention special variables in lexbind Info page) Message-ID: References: <86o71zcr8g.fsf@gnu.org> <54843.1732582325@alto.camomileplus.org> X-Gnu-PR-Message: they-closed 74540 X-Gnu-PR-Package: emacs Reply-To: 74540@debbugs.gnu.org Date: Thu, 28 Nov 2024 15:29:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1732807742-31100-1" This is a multi-part message in MIME format... ------------=_1732807742-31100-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #74540: 30.0.91; mention special variables in lexbind Info page which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 74540@debbugs.gnu.org. --=20 74540: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D74540 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1732807742-31100-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 74540-done) by debbugs.gnu.org; 28 Nov 2024 15:28:46 +0000 Received: from localhost ([127.0.0.1]:39385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGgRh-00084v-Kd for submit@debbugs.gnu.org; Thu, 28 Nov 2024 10:28:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGgRf-00084b-Fv for 74540-done@debbugs.gnu.org; Thu, 28 Nov 2024 10:28:44 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGgRZ-0000P0-7h; Thu, 28 Nov 2024 10:28:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=LcAueHu4IpJ4jjVc44nS5EoHlJCY4J5AvV61LKHcxgI=; b=nkLM/AFbpJlk dtd0OCNwOwAsNIxo9DlURsoaKx+oNrPz2yfK13Vax37p47G0/G+ng2ZUbi31H5kyqgR9YM+MZ1kv0 GMG3xs6zt1+FuVWkfi6kfF5F1xpLb2GRN19eimxpoYHLed8Gh+X2xznHzQLnvRgmAtgX8lf0gIzCH 1obHTmdsF+/hVKpD4sp9gfNAW/vtN9MEa9Jbdrx7qREQXlP62bcjXBq2gx6J19SfodaDZAHYozJsr aALPIhcpVqN9VJGGfuoVcbq7y0YoZKBCe6VYgSSlLWv3Y+MVFhLDy3Nu3LBewtoJvgJSdLdqHJb3K uRYud5fDHaVwifH/KDgzaA==; Date: Thu, 28 Nov 2024 17:28:31 +0200 Message-Id: <86o71zcr8g.fsf@gnu.org> From: Eli Zaretskii To: Mike Kupfer In-Reply-To: <54843.1732582325@alto.camomileplus.org> (message from Mike Kupfer on Mon, 25 Nov 2024 16:52:05 -0800) Subject: Re: bug#74540: 30.0.91; mention special variables in lexbind Info page References: <54843.1732582325@alto.camomileplus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74540-done Cc: 74540-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mike Kupfer > Date: Mon, 25 Nov 2024 16:52:05 -0800 > > When I first read up on lexical binding, I didn't realize that I also > needed to review the documentation for dynamic binding, so that I > could learn about special variables. I think it would be good for the > Info page for lexical binding to mention special variables, clarify > that the specialness also affects new bindings (not just the initial > defvar/defcustom/defconst), and provide a link to the page for dynamic > binding (for details about special variables). > > I've enclosed a draft patch for your consideration. Thanks, installed on the emacs-30 branch, and closing the bug. ------------=_1732807742-31100-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 26 Nov 2024 00:52:21 +0000 Received: from localhost ([127.0.0.1]:43368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFjoS-0007Vy-UW for submit@debbugs.gnu.org; Mon, 25 Nov 2024 19:52:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:45668) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFjoR-0007Vq-Cu for submit@debbugs.gnu.org; Mon, 25 Nov 2024 19:52:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFjoO-00048I-9O for bug-gnu-emacs@gnu.org; Mon, 25 Nov 2024 19:52:17 -0500 Received: from shell1.rawbw.com ([198.144.192.42]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFjoM-0005Rv-Eu for bug-gnu-emacs@gnu.org; Mon, 25 Nov 2024 19:52:16 -0500 Received: from alto.camomileplus.org (135-180-174-211.dsl.dynamic.sonic.net [135.180.174.211] (may be forged)) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id 4AQ0q5KL037333 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 25 Nov 2024 16:52:11 -0800 (PST) (envelope-from kupfer@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host 135-180-174-211.dsl.dynamic.sonic.net [135.180.174.211] (may be forged) claimed to be alto.camomileplus.org From: Mike Kupfer To: bug-gnu-emacs@gnu.org Subject: 30.0.91; mention special variables in lexbind Info page X-Mailer: MH-E 8.6+git; nmh 1.8-RC2; Emacs 30.0.91 X-Debbugs-Cc: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Mon, 25 Nov 2024 16:52:05 -0800 Message-ID: <54843.1732582325@alto.camomileplus.org> Received-SPF: pass client-ip=198.144.192.42; envelope-from=kupfer@rawbw.com; helo=shell1.rawbw.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain When I first read up on lexical binding, I didn't realize that I also needed to review the documentation for dynamic binding, so that I could learn about special variables. I think it would be good for the Info page for lexical binding to mention special variables, clarify that the specialness also affects new bindings (not just the initial defvar/defcustom/defconst), and provide a link to the page for dynamic binding (for details about special variables). I've enclosed a draft patch for your consideration. thanks, mike --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=lexbind-special-vars.patch Content-Description: draft patch user: Mike Kupfer date: Mon Nov 25 15:37:53 2024 -0800 files: doc/lispref/variables.texi description: Mention special variables in lexical binding documentation * doc/lispref/variables.texi (Lexical Binding): Briefly mention special variables and their semantics. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1096,7 +1096,7 @@ @end example @noindent -The @code{let} binding defines a lexical environment in which the +Here, the @code{let} binding defines a lexical environment in which the variable @code{x} is locally bound to 0. Within this binding construct, we define a lambda expression which increments @code{x} by one and returns the incremented value. This lambda expression is @@ -1113,6 +1113,12 @@ variable's dynamic binding (i.e., the contents of its symbol's value cell). + Note also that variables may be declared special, in which case they +will use dynamic binding, even for new bindings such as a @code{let} +binding. Depending on how the variable is declared, it can be +special globally, for a single file, or for a portion of a file. +@xref{Dynamic Binding} for details. + @node Dynamic Binding @subsection Dynamic Binding --=-=-=-- ------------=_1732807742-31100-1--