From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: lexical-binding is turned on in more use cases Date: Mon, 9 Mar 2020 20:22:59 +0000 Message-ID: <20200309202259.GA16294@ACM> References: <83pndo9zeb.fsf@gnu.org> <83o8t6bx2p.fsf@gnu.org> <83k13ubv3g.fsf@gnu.org> <83imjebsrh.fsf@gnu.org> <20200308193048.GB4832@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="129828"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 09 21:24:06 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jBOwW-000XeL-Th for ged-emacs-devel@m.gmane-mx.org; Mon, 09 Mar 2020 21:24:04 +0100 Original-Received: from localhost ([::1]:49360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBOwV-000377-Ul for ged-emacs-devel@m.gmane-mx.org; Mon, 09 Mar 2020 16:24:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60789) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBOvY-0001Xn-Td for emacs-devel@gnu.org; Mon, 09 Mar 2020 16:23:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBOvX-0004ri-Qx for emacs-devel@gnu.org; Mon, 09 Mar 2020 16:23:04 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:46106 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1jBOvX-0004qf-I9 for emacs-devel@gnu.org; Mon, 09 Mar 2020 16:23:03 -0400 Original-Received: (qmail 32524 invoked by uid 3782); 9 Mar 2020 20:23:01 -0000 Original-Received: from acm.muc.de (p4FE15BBB.dip0.t-ipconnect.de [79.225.91.187]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 09 Mar 2020 21:22:59 +0100 Original-Received: (qmail 22846 invoked by uid 1000); 9 Mar 2020 20:22:59 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245411 Archived-At: Hello, Stefan. On Sun, Mar 08, 2020 at 19:41:44 -0400, Stefan Monnier wrote: > > . This complained about c-syntactic-context being unbound, so I > > tried: > > M-: (let ((c-syntactic-context (c-guess-basic-syntax))) > > (c-align-cpp-indent-to-body)) > > , and was puzzled that c-syntactic-context was _still_ unbound. So I > > checked the spelling, and was more puzzled. Eventually I used setq, > > which worked, but caused me further problems later on in my Emacs > > session. > Indeed `c-syntactic-context` is only declared as dynamically scoped in > some files but not globally, for some reason. That reason appearing to be a misfeature of defvar. Why is (defvar foo) a no-op? Why does it not set the declared_special bit inside the symbol? This would be sensible and consistent (even if unacceptable for Emacs 27). > It's rather unusual. Even if that's the case, it doesn't make it unimportant. Let binding from the minibuffer should work consistently, its effect not varying chaotically between dynamic and lexical binding. [ .... ] > > Furthermore, c-syntactic-context is explicitly declared a dynamic > > variable by a defvar form. > But a `defvar` with no 2nd arg (i.e. no default value), which means it > only affects the current file (not sure if this is part of the reason > why you have `(defvar c-syntactic-context)` both `cc-cmds.el` and in > `cc-vars.el`, but it would explain it tho the `(cc-bytecomp-defvar > c-syntactic-context)` in `cc-vars.el` makes the whole situation much > more murky). See above. defvar should not be a no-op. It shouldn't be necessary to write (defvar foo) in more than one file. > > THIS IS A MAJOR BACKWARD STEP FOR EMACS!!!! > ;-) > > Looking at the git log, it appears this change was made nearly a year ago. > Indeed, it's a wonder you managed to survive with such a majorly broken > Emacs for so long ;-) Why did you not initiate a discussion on emacs-devel before committing this patch? Also the title of the patch is highly misleading, since the patch has nothing to do with defaults, only with forced lexical binding, whether wanted or not. How about making this lexical binding optional, controlled by a customisable variable? It would not be difficult. > Stefan -- Alan Mackenzie (Nuremberg, Germany).