From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jens Schmidt Newsgroups: gmane.emacs.devel Subject: Re: Emacs script options Date: Tue, 21 Nov 2023 22:13:22 +0100 Message-ID: <5eac9978-270e-40b2-8272-dabb29ec5daa@vodafonemail.de> References: <1325582.1700277236@archlinux> <8734x2zwnc.fsf@whxvd.name> <7953.1700336960@archlinux> <24ea16b3-e3e7-457b-99b9-3f3805de3f66@vodafonemail.de> <58266.1700443175@archlinux> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33433"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Sebastian Miele , emacs-devel@gnu.org To: Greg Minshall Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 21 22:14:43 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 1r5Y4x-0008U2-EI for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Nov 2023 22:14:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5Y4C-0007rr-8y; Tue, 21 Nov 2023 16:13:57 -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 1r5Y47-0007qI-Tz for emacs-devel@gnu.org; Tue, 21 Nov 2023 16:13:52 -0500 Original-Received: from mr3.vodafonemail.de ([145.253.228.163]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5Y44-0007HF-IZ for emacs-devel@gnu.org; Tue, 21 Nov 2023 16:13:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1700601226; bh=NQDP208wE5tTYjvSvA/EEQwrvxHWzzrkw8eFwmjMUy4=; h=Message-ID:Date:User-Agent:Subject:To:References:From: Content-Language:In-Reply-To:Content-Type:From; b=jY77ALF68dl8O/FC6LrG8MMCOLAtKcH3QOMAYVBFmnyr58Ma20wDctVFpwsaawAkE povCM/RkmVQ0KU6rHoME0bwEoqkYoZLI5HDf53KB3CpC8TKgG37qDShxDE/DeG1/M2 lLXZ1KgJFbboYZ3OyeI6UlVcQoxeYxdw+VZ1dvNM= Original-Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr3.vodafonemail.de (Postfix) with ESMTPS id 4SZcYj6ntqz20Xr; Tue, 21 Nov 2023 21:13:45 +0000 (UTC) Original-Received: from [192.168.178.41] (port-92-196-26-194.dynamic.as20676.net [92.196.26.194]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4SZcYW2w4JzMks2; Tue, 21 Nov 2023 21:13:32 +0000 (UTC) Content-Language: de-DE-frami, en-US In-Reply-To: <58266.1700443175@archlinux> X-purgate-type: clean X-purgate: clean X-purgate-size: 1420 X-purgate-ID: 155817::1700601221-F2FF9228-096A4CBB/0/0 Received-SPF: pass client-ip=145.253.228.163; envelope-from=jschmidt4gnu@vodafonemail.de; helo=mr3.vodafonemail.de 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, RCVD_IN_MSPIKE_H2=-0.001, 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:313122 Archived-At: On 2023-11-20 02:19, Greg Minshall wrote: > no way, NO way near hack'y enough. :) I couldn't stand the fact that my hack was taken already plus that it is flawed, so I set off to extend it with a work-around for the lexical-binding issue. While there are surely other methods to achieve what below code does, supposedly also more stable ones, I wanted to go for brevity to keep the non-script overhead small: ------------------------- escript ------------------------- #!/bin/sh : ; exec emacs --script "$0" -- "$@" #; -*- lexical-binding: t -*- ;; Work around `eval-buffer' not recognizing the lexical-binding ;; stanza when the comment containing it does not start at first ;; column (bug#67321). (unless (ignore-errors (funcall (let ((v t)) (lambda () v)))) (with-current-buffer (car eval-buffer-list) (goto-char (point-min)) (search-forward "; -*-") (delete-region (point-min) (match-beginning 0)) (eval-buffer))) ;; Script payload. (message "%S:%S" lexical-binding command-line-args-left) ;; Explicitly exit Emacs to not return from the second-level ;; `eval-buffer'. (kill-emacs 0) ;;; Local Variables: ;;; mode: emacs-lisp ;;; End: ------------------------- escript ------------------------- (Thanks to Sebastian for opening the bug, BTW. When looking at the previous, now merged bug, it seems that this won't be something easy to get through.)