From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sebastian Miele Newsgroups: gmane.emacs.devel Subject: Re: Emacs script options Date: Tue, 21 Nov 2023 09:51:55 +0100 Message-ID: <87y1erscxz.fsf@whxvd.name> References: <1325582.1700277236@archlinux> <8734x2zwnc.fsf@whxvd.name> <7953.1700336960@archlinux> <24ea16b3-e3e7-457b-99b9-3f3805de3f66@vodafonemail.de> <87v89xx83i.fsf@whxvd.name> <208d9b6b-af64-432b-bc1d-f57e00ec0801@vodafonemail.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23537"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Greg Minshall , emacs-devel@gnu.org To: Jens Schmidt Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 21 09:56:18 2023 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 1r5MYM-0005nB-N8 for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Nov 2023 09:56:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5MXg-0002F1-Cy; Tue, 21 Nov 2023 03:55:36 -0500 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 1r5MXc-0002Ee-D8 for emacs-devel@gnu.org; Tue, 21 Nov 2023 03:55:32 -0500 Original-Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1r5MXZ-0003vS-QL for emacs-devel@gnu.org; Tue, 21 Nov 2023 03:55:32 -0500 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4SZJ9k2cVDz9snJ; Tue, 21 Nov 2023 09:55:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=whxvd.name; s=MBO0001; t=1700556922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jipRppt5vb1+GpLG/zQQxm+oCAZsAVGnbyQON7c8nHU=; b=ZClF6X5EEO1yPRX0bUc6Q1eYzG5WdmP0CdKWqksI/WzbdmHtghP4QiJkCqjwC8oRfKGPfE bl0RexDg1rRjHDeasRVqjZayf7Cm3zuy2C+N/y/wAMflUR73xhpMQUNrxbDutgljxhzdTo 524DrYuPpRGl3lzjPpgwiXp8IVgln9q3x81es+1iCDyJoXxfvHAJtGbQVarOgqCSK3faJz Fij1ZCxBsmqMDMvfCeGfoGt935Or6/3z+15jHUz7pXE0ga+szOvtzVa9I85/2xvjlE9NuT IyCEZsvPzur3U7U6A40dQ15rjlRfAGt3RKTStRVmFsTy3fiT80EZJXAHom/jBw== In-reply-to: <208d9b6b-af64-432b-bc1d-f57e00ec0801@vodafonemail.de> Received-SPF: pass client-ip=2001:67c:2050:0:465::101; envelope-from=iota@whxvd.name; helo=mout-p-101.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:313100 Archived-At: > From: Jens Schmidt > Date: Mon, 2023-11-20 21:10 +0100 > > On 2023-11-20 07:10, Sebastian Miele wrote: > >> But it has a problem with lexical binding. Consider: >> >> #!/bin/sh >> : ; exec emacs --script "$0" -- "$@" #; -*- lexical-binding: t; mode: = emacs-lisp -*- >> >> (defmacro lexical-binding-p () >> '(let* ((x t) >> (f (lambda () x)) >> (x nil)) >> (funcall f))) >> >> (message "%s %s" lexical-binding (lexical-binding-p)) >> >> When I run it as a script, the output is "nil nil", i.e., the script >> definitely does not run with lexical binding enabled. When I evaluate >> it in a buffer, the output is "t t". > > I tried byte-compiling something similar yesterday, which also > indicated that the byte-compiler compiles with lexical bindings. Only > the scripting machinery sees dynamical bindings. > > [=E2=80=A6] It seems that the scripting machinery expects a semicolon in= the > very first column, without that the lexical-binding line is not > recognized. Even a space before the semicolon breaks the recognition. > > The problem is in function `lisp_file_lexically_bound_p' from lread.c, > which is indeed much more strict in its recognition of the -*- ... -*- > stanza than the functions `set-auto-mode-1' and > `hack-local-variables-prop-line' from files.el. The Emacs manual > ((emacs) Specifying File Variables) only mentions that the stanza > has to be in the first line (or the second one if the first is taken > by a she-bang), without any restriction where the comment has to > start. Thank you for the additional investigation into and information about the issue. > Would you or Greg report that as a bug? Done, https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D67321.