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: Mon, 20 Nov 2023 07:10:00 +0100 Message-ID: <87v89xx83i.fsf@whxvd.name> References: <1325582.1700277236@archlinux> <8734x2zwnc.fsf@whxvd.name> <7953.1700336960@archlinux> <24ea16b3-e3e7-457b-99b9-3f3805de3f66@vodafonemail.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38185"; 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 Mon Nov 20 07:17:42 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 1r4xbI-0009jG-Px for ged-emacs-devel@m.gmane-mx.org; Mon, 20 Nov 2023 07:17:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4xaU-0005i7-GV; Mon, 20 Nov 2023 01:16:51 -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 1r4xaQ-0005hq-Ok for emacs-devel@gnu.org; Mon, 20 Nov 2023 01:16:46 -0500 Original-Received: from mout-p-101.mailbox.org ([80.241.56.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1r4xaN-00050R-Qx for emacs-devel@gnu.org; Mon, 20 Nov 2023 01:16:45 -0500 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::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 4SYchz3vDlz9sTD; Mon, 20 Nov 2023 07:16:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=whxvd.name; s=MBO0001; t=1700460995; 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: in-reply-to:in-reply-to:references:references; bh=zGx3GRZxiR8GvinmVlM4KhX3agpoOPd9QdbfoHsAxvE=; b=eT0axLPpTMcbpD5768RMduciq0h+zvfSESVRhqiada5eMCAuaVE1IBHnzJqeBeQ780xIkd yb/kjaanJ/u9QzQOkKhIkcIA8wdk+BW0dxhJTguk34U1Qddl12s/+Xf8eIPGgI7bLtaeDX SHfXZhcgefJZAtJNziJxM4r8zCD5ClmmKNUShZnsnBc5zSfid+gWPJgJ865EK11yznVby8 XIO+O+UQj0PBpydmeNMGWRtcZ5+JPHvCZcIEgUg/sK51c7GErFDR38QGj7Mofn8rKBIKEQ kHC6qfLkUfkvi0/qg9cAMCnEE1Zj1PDdkJaI/Mm/ppfyHtSa/DFxLSX6pd8tqA== In-reply-to: X-Rspamd-Queue-Id: 4SYchz3vDlz9sTD Received-SPF: pass client-ip=80.241.56.151; 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:313038 Archived-At: > From: Jens Schmidt > Date: Sun, 2023-11-19 22:47 +0100 > > ------------------------- test ------------------------- > #!/bin/sh > : ; exec emacs --script "$0" -- "$@" #; -*- lexical-binding: t -*- > (message "%S" command-line-args-left) > ------------------------- test ------------------------- This is the trick that Doom Emacs employs, see https://github.com/doomemacs/doomemacs/blob/master/bin/doom. 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". When I discovered the problem some while ago, I wanted to report it as an issue to Doom Emacs, but the bars for reporting issues to that specific project were set to high for me to actually go through the process. But maybe it should be reported as an Emacs bug?