From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64272: 28.1; lisp_file_lexically_bound_p behavior mismatches file local variables Date: Sun, 25 Jun 2023 21:16:53 +0300 Message-ID: <83h6qvxv8q.fsf@gnu.org> References: <83zg4oy9ow.fsf@gnu.org> <83wmzsxedw.fsf@gnu.org> <83mt0ny47z.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12370"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64272@debbugs.gnu.org, andpuke@foxmail.com, monnier@iro.umontreal.ca To: LdBeth Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 25 20:17:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qDUIV-0002zk-0g for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Jun 2023 20:17:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDUIK-0008Gs-9Y; Sun, 25 Jun 2023 14:17:04 -0400 Original-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 1qDUII-0008Gd-Ez for bug-gnu-emacs@gnu.org; Sun, 25 Jun 2023 14:17:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDUII-00019A-6k for bug-gnu-emacs@gnu.org; Sun, 25 Jun 2023 14:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDUII-0008EB-2X for bug-gnu-emacs@gnu.org; Sun, 25 Jun 2023 14:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Jun 2023 18:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64272 X-GNU-PR-Package: emacs Original-Received: via spool by 64272-submit@debbugs.gnu.org id=B64272.168771700531602 (code B ref 64272); Sun, 25 Jun 2023 18:17:02 +0000 Original-Received: (at 64272) by debbugs.gnu.org; 25 Jun 2023 18:16:45 +0000 Original-Received: from localhost ([127.0.0.1]:43661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDUI1-0008Dd-F4 for submit@debbugs.gnu.org; Sun, 25 Jun 2023 14:16:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDUHy-0008DP-Hx for 64272@debbugs.gnu.org; Sun, 25 Jun 2023 14:16:44 -0400 Original-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 1qDUHq-00017R-Tk; Sun, 25 Jun 2023 14:16:34 -0400 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=7Hk93dTLALIeryRMluhAq9OP3DZB9sgegVPMjPWCAOA=; b=I/80mE3Od0Zw m4PVvuqMxaQRCzstXfxXY8sdVK5cm2+zK6fedizpEzPHCS+w2hXW2GLbysbPixegXedZbtZZ8KrbI T+sQoud+rFL6Fx/otNL71N89yCJgum2UvBa/7IbBvKCPoFtElEXOo8YLbfqaiztVujrFwRJhdJhMs m++w2TN8EUFvMJT2kDA1O3ljyZb8m93rhqGEDUSBNEMFWkj2XOuCBLB34SiWHeViHcO4T58YMciKC xsOVO2lc8W/JI7EAkYzpy6a3/RXqzVqrwPMdCiV2o+MfM0YtHTbGsoWCqYf5QgAp2rFcDmkomLMj7 7RK5RoilmX5/TzQcRCmQXQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDUHq-0001LN-Da; Sun, 25 Jun 2023 14:16:34 -0400 In-Reply-To: (message from LdBeth on Sun, 25 Jun 2023 12:17:40 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264065 Archived-At: > Date: Sun, 25 Jun 2023 12:17:40 -0500 > From: LdBeth > Cc: Stefan Monnier , > andpuke@foxmail.com, > 64272@debbugs.gnu.org > > >>>>> In <83mt0ny47z.fsf@gnu.org> > >>>>> Eli Zaretskii wrote: > > Eli> I'm not sure we want to support this outside of a Lisp comment. > Eli> Stefan, WDYT? Could false positives cause harm? > > Stefan> I'd much rather we try and stay as close as possible to the behavior of > Stefan> `hack-local-variables-prop-line` > > Eli> The fact that most -*- lines are in comments is because they are in > Eli> program source files, so we need to hide them from the compiler or the > Eli> interpreter. > > Eli> Am I missing something? > > Ok I find the reason the `lisp_file_lexically_bound_p' would give > up if the first line isn't a comment is, it said: > > Return true if the lisp code read using READCHARFUN defines a non-nil > `lexical-binding' file variable. After returning, the stream is > positioned following the first line, if it is a comment or #! line, > otherwise nothing is read. > > So this function assumes the first line is discarded if file local > variables would have been read. > > If first line is lisp code, and we want to keep the similar > behavior of `hack-local-variables-prop-line`, there needs a mean > to buffer the content of the first line. (Or reset file position > but I don't think there is a way to do that without > substantially change lread.c) There isn't. We can only unread one character at a time. > But it would be easier to only handle the extra whitespace at > beginning of file. So now let me turn the table and ask: if we are only going to support whitespace before the semicolon, then what exactly are we gaining here?