From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#67321: 29.1.90; Different parsing rules for -*- lexical-binding:t; -*- in different circumstances Date: Wed, 22 Nov 2023 15:59:15 +0100 Message-ID: References: <8734wzts37.fsf@whxvd.name> <87cyw1gb9c.fsf@whxvd.name> 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="23504"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 67321@debbugs.gnu.org To: Sebastian Miele Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 22 16:00:25 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 1r5oiG-0005vr-P8 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Nov 2023 16:00:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5ohs-0002b3-5H; Wed, 22 Nov 2023 10:00:00 -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 1r5ohr-0002ag-6R for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 09:59:59 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5ohq-0002vB-UP for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 09:59:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r5ohu-0005BE-5r for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 10:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Nov 2023 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67321 X-GNU-PR-Package: emacs Original-Received: via spool by 67321-submit@debbugs.gnu.org id=B67321.170066517019837 (code B ref 67321); Wed, 22 Nov 2023 15:00:02 +0000 Original-Received: (at 67321) by debbugs.gnu.org; 22 Nov 2023 14:59:30 +0000 Original-Received: from localhost ([127.0.0.1]:59564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5ohO-00059s-1P for submit@debbugs.gnu.org; Wed, 22 Nov 2023 09:59:30 -0500 Original-Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:55430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5ohL-00059e-Ps for 67321@debbugs.gnu.org; Wed, 22 Nov 2023 09:59:28 -0500 Original-Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-548f74348f7so3201231a12.2 for <67321@debbugs.gnu.org>; Wed, 22 Nov 2023 06:59:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700665158; x=1701269958; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xuahfimlWucREsgDxImXAFR2f7qkjjjw0BKMheFpk6I=; b=gW3O8hB2inG9bMJbcm7tmYdes0dR208UgIZ09lsbWMV4hxce8wvNAwb2LPhijrqh6c 4OeaRB4j4AQw4wYH/RyLuoEbE3HposQgMZ1twWKCGMINkURX7DwiaEXNKDNZ/6H4t9Qt 5bxRZm88I51lhZp8g90ZAZyvOEgn1ABsFYy+HDHGaq0NAnfP0v9/w+WNaYHbQoqjociz 6QVW7Ai06w02hPRG87/ke3DddFtPb6LR+zowQQGNYAwUv98FJBbYYS3W1vt9X2n172jh EL8yuXCLtKs8GENAbNvT+WEP9GUbjevtqRmhGP1LIPlLcYoDgEdRw0wmtYvq2yjDiZ7Z DOQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700665158; x=1701269958; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xuahfimlWucREsgDxImXAFR2f7qkjjjw0BKMheFpk6I=; b=tuaZf2fh6PlkEJ9Zg9/5dhBemcNT4P5UjMiB2i912Bsmeet+OJrB5Kn3XPZDsIGu69 B3VcuJ5uDOYApYeCrjkzNH1PNHdxmMDaHr/Izvw/Y6aSg3kyZICe25fdeW92gPNAOww3 EOhfjbkCvbTsL8pkkFPZxrAEr64R901rT3wWl7zbjPaT7uA/KxNspyAZms2MyW3PbzVe cpVa3jM8iK3lT9Htr50mMSsanoOJabjTt0XDPxlEAWdr1Wc+KEJK0SerNmEYPC5ZuTM1 Vkp6Qb+jaJIRc2PVRwt9Pk/cWBtOpsI1vaVeNiOm7LfDQHJExorf86Km7UUIRUAddLFY LFfw== X-Gm-Message-State: AOJu0Yy8NaQb8KVSoZLq7FShM/Wu7xmO5/K4Fk7RpxanwEC937rkKqsN yggHr9UMDFvM1cVqumy+37+uluUrBYU= X-Google-Smtp-Source: AGHT+IFby3eR/YehIzqQnjfQcgTC689ejGOv6VQTtXAu7yNf/NsG2sEm1uAFBcL8AYs/TGPHvL2MLQ== X-Received: by 2002:a05:6402:7d6:b0:53e:e6eb:c838 with SMTP id u22-20020a05640207d600b0053ee6ebc838mr2149807edy.8.1700665157724; Wed, 22 Nov 2023 06:59:17 -0800 (PST) Original-Received: from Pro.fritz.box (p4fe3a2b1.dip0.t-ipconnect.de. [79.227.162.177]) by smtp.gmail.com with ESMTPSA id w6-20020aa7d286000000b00548b96a52besm3707459edq.78.2023.11.22.06.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 06:59:17 -0800 (PST) In-Reply-To: <87cyw1gb9c.fsf@whxvd.name> (Sebastian Miele's message of "Wed, 22 Nov 2023 14:07:38 +0100") 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:274760 Archived-At: Sebastian Miele writes: >> From: Gerd M=C3=B6llmann >> Date: Tue, 2023-11-21 11:46 +0100 >> >>> #!/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)) >> >> Can I ask why that idiom is used? > > The idiom allows arbitrary shell processing before, and possibly even > after, actually running Emacs in the script. > > See https://github.com/doomemacs/doomemacs/blob/master/bin/doom for an > example including both pre- and postprocessing, and lots of comments > about what is done there, and why. > > Another case that recently popped up on emacs-devel is that it allows to > insert the "--" for cleanly separating the script commandline options > from options that Emacs may interpret, see > https://lists.gnu.org/archive/html/emacs-devel/2023-11/msg00896.html. > > I do not know anymore why I considered the trick in the past. I do not > want to spend the time to look into my scripts to find that bits that > would become cumbersome without such tricks. Because of the problem > with lexical-binding not being picked up, and because I, for now, have > the luxury of only using Linux, I can use another trick. But being able > to mangle the command line of Emacs before running Emacs definitely is a > useful thing. The portable alternative would be to have one separate > (shell) wrapper around every Emacs script that needs such mangling. Thanks, Sebastian. I got the trick, though it took me a minute. Clever, clever :-). TBH, I don't see a good reason why that should be used instead of the much simpler cat >somefile <