GNU bug report logs - #64939
30.0.50; The default auto-mode-interpreter-regexp does not match env with flags

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>; dated Sat, 29 Jul 2023 20:30:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 64939 <at> debbugs.gnu.org:


Received: (at 64939) by debbugs.gnu.org; 30 Jul 2023 05:05:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 30 01:05:01 2023
Received: from localhost ([127.0.0.1]:49170 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qPyc0-0000OT-OU
	for submit <at> debbugs.gnu.org; Sun, 30 Jul 2023 01:05:01 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42632)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qPybz-0000OH-FE
 for 64939 <at> debbugs.gnu.org; Sun, 30 Jul 2023 01:04:59 -0400
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 <eliz@HIDDEN>)
 id 1qPybu-0000vd-91; Sun, 30 Jul 2023 01:04:54 -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=G/2VXlHePi/XFe1ZZ4R4WqROz+Zr0TbrH+x7nCh3kvA=; b=kPaFz3/zga7r
 KrB9rhRW33E/Vh9i0u+3/LC3esemjn++pzJKl9gp4qLj236N06YX32fTv0dKgM2Q1+vgbrUQMhjU0
 O7m4T0Ps2ozjbm08xmvwngI3tf81FEs4DqfP5fVx0TPWQ2aIoRJb1upWpDICIGJMM+5iaQdA0hRLA
 qp+5Wz/X7Tv+lIahPI3mZW/3cg9lsFuWmbV7FLukgPKCS4KK30e35BclgU2YyhUVDyChZhBlzdq0P
 F8V6xBac+7mMLyT/TTsMKZo++VDWQZdUubmtWA8WbAGNe94fZe6uGJitKxC8hCsiZkekqmq8oCZwZ
 LMfmcN5I1SMgtoTlkBFoqQ==;
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 <eliz@HIDDEN>)
 id 1qPybt-0000FQ-OE; Sun, 30 Jul 2023 01:04:54 -0400
Date: Sun, 30 Jul 2023 08:04:53 +0300
Message-Id: <83y1iykn0q.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
In-Reply-To: <878rays89s.fsf@HIDDEN> (message from Wilhelm Kirschbaum on
 Sat, 29 Jul 2023 23:38:07 +0200)
Subject: Re: bug#64939: 30.0.50;
 The default auto-mode-interpreter-regexp does not match env with flags
References: <87mszebgwy.fsf@HIDDEN> <878rays89s.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64939
Cc: 64939 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
> Date: Sat, 29 Jul 2023 23:38:07 +0200
> 
> This is a very naive solution to the above, but I am probably
> missing some knowledge here and will break for anyone setting the
> var to something custom.

Feel free to make this change locally, but I don't see how this can be
general enough for us to install it as the default value.

For starters, 'env' can be invoked with several options, not just with
one.  Also, some 'env' options accept arguments, and how do we know if
the word that follows "env -OPTION" is the command to check against
interpreter-mode-alist or an argument of an option?

IOW, I don't think this is a problem for a regexp-based solution.  If
we want to support such complex shebang lines (btw, does the Posix or
GNU/Linux shell support them?), we should analyze the text after "env"
to find the candidate interpreter.  Not sure whether even that will
provide a robust solution.

Btw, can't you satisfy your needs via file-local variables?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#64939; Package emacs. Full text available.

Message received at 64939 <at> debbugs.gnu.org:


Received: (at 64939) by debbugs.gnu.org; 30 Jul 2023 04:53:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 30 00:53:54 2023
Received: from localhost ([127.0.0.1]:49163 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qPyRG-00061b-G2
	for submit <at> debbugs.gnu.org; Sun, 30 Jul 2023 00:53:54 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35864)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qPyRB-00061M-S2
 for 64939 <at> debbugs.gnu.org; Sun, 30 Jul 2023 00:53:52 -0400
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 <eliz@HIDDEN>)
 id 1qPyR6-0004Sq-Cu; Sun, 30 Jul 2023 00:53:44 -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=awSoqVjsnSl6aIvigBunI2EOhjGorXNES3ZV7FsGV9Q=; b=Loq3MaD5DWef
 5JDAxMFzVL9v1U/UCGVFhIoNJxGKBvQM+0xQ6yNmAIiTuyOG82gq6smWX+c2FD+9hdHBo+Wt75Xqe
 doXbkA5T3UihYlMku5PkUFovF5xtlpBr0CqogcCuAeyCWBKLjwAB9m93dZv02YrUqU6aqyLuieEpL
 sYcZoT3mOh07NbFCrTVR6DaxbOjW8JmCRV/gK2fGM2sgVx64jGGMS4gVDa+aDlt0lZRu52/QWiF+2
 epOFpQ2DBHNESSM82knoH9s1Eh3OR8DKBLuaU7sAzlkFg82kDM4sLe77zWYZcF7VzogFaXSGATB1D
 PDONbcqaQ3/zAC4YsfW4xw==;
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 <eliz@HIDDEN>)
 id 1qPyR5-0000fh-Pz; Sun, 30 Jul 2023 00:53:44 -0400
Date: Sun, 30 Jul 2023 07:53:42 +0300
Message-Id: <83zg3eknjd.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
In-Reply-To: <87mszebgwy.fsf@HIDDEN> (message from Wilhelm Kirschbaum on
 Sat, 29 Jul 2023 22:08:19 +0200)
Subject: Re: bug#64939: 30.0.50;
 The default auto-mode-interpreter-regexp does not match env with flags
References: <87mszebgwy.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64939
Cc: 64939 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
> Date: Sat, 29 Jul 2023 22:08:19 +0200
> 
> 
> A file without an extension will load ruby-mode if the first line 
> is:
> 
>     #!/usr/bin/env ruby
> 
> but not when the first line is:
> 
>     #!/usr/bin/env -S ruby -e 'puts 123'
> 
> Is there any reason why the latter should not be matched by the 
> default
> `auto-mode-interpreter-regexp' value in 'files.el'?

That line _is_ matched by auto-mode-interpreter-regexp:

  (string-match-p auto-mode-interpreter-regexp "#!/usr/bin/env -S ruby -e 'puts 123'") => 0

The problem is how to find the name of the interpreter if the text
after "/usr/bin/env" includes more than one word?  Once we start using
command-line switches and their arguments, and take into consideration
that many GNU/Linux programs can freely intersperse options and
non-option arguments on the command line in any order, where does this
end?

> A more useful example I stumbled on today while working on a 
> language
> server after adding:
> 
> `(add-to-list 'interpreter-mode-alist '("elixir" 
> . elixir-ts-mode))'
> 
> 
>     #!/usr/bin/env -S elixir --erl "-kernel standard_io_encoding 
>     latin1"

How about making a script that invokes elixir with those arguments,
and then augment interpreter-mode-alist to name that script instead?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#64939; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Jul 2023 21:44:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 29 17:44:14 2023
Received: from localhost ([127.0.0.1]:49071 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qPrjS-00040N-1P
	for submit <at> debbugs.gnu.org; Sat, 29 Jul 2023 17:44:14 -0400
Received: from lists.gnu.org ([2001:470:142::17]:55054)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wkirschbaum@HIDDEN>) id 1qPrjQ-000409-9s
 for submit <at> debbugs.gnu.org; Sat, 29 Jul 2023 17:44:12 -0400
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 <wkirschbaum@HIDDEN>)
 id 1qPrjK-0005qh-LB
 for bug-gnu-emacs@HIDDEN; Sat, 29 Jul 2023 17:44:06 -0400
Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <wkirschbaum@HIDDEN>)
 id 1qPrjJ-0002k7-7I
 for bug-gnu-emacs@HIDDEN; Sat, 29 Jul 2023 17:44:06 -0400
Received: by mail-wm1-x329.google.com with SMTP id
 5b1f17b1804b1-3fe104df822so18788135e9.1
 for <bug-gnu-emacs@HIDDEN>; Sat, 29 Jul 2023 14:44:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1690667043; x=1691271843;
 h=mime-version:message-id:in-reply-to:date:subject:to:from:user-agent
 :references:from:to:cc:subject:date:message-id:reply-to;
 bh=ClMgi5rVBG8umS11gjVntEFE195xP2hPHvyi16FmNYg=;
 b=KKgHBziAal2AVhqo/eH3WMxurpM4EI7lSCRMlZLxHSGLfNScXROsA2Cn3JdbeZwe/r
 ogEuYwIj15vb200JPyDE6lqZ1FwMAuERzZbZqridtOZYp11vdiOY5MelUjN/wfDW2b1c
 RZH9ofnivZ+7/Y8V658iTMY27ejLO+n7DTW2oYUk23beZxsenBfdRvBT6PRBnIyDj5gh
 MSTd8Ei38udsdPcoG/pDgK4N8vjGjvpIZic7Q+BOMvj2ne+8/+QDkAjmw+Fue6kEoVlV
 MfjK9v3IMFnihq7L6LrUBwx17REzZXDOAZV33VDjnpGHZSJurMCZ8RvKaABIjJ0nnKev
 wJUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1690667043; x=1691271843;
 h=mime-version:message-id:in-reply-to:date:subject:to:from:user-agent
 :references:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=ClMgi5rVBG8umS11gjVntEFE195xP2hPHvyi16FmNYg=;
 b=Eb3RdM+fu80M+aa9Ht5nnb1RUHYH+bMxGFWbWtvTHL7K4RsIpbdBFkuybqLzUqO7Sd
 VOxyqbP791POVNeW5JadDvjGQQwvHuKc4GrsJR/7K/owVAYUfEP3adAvXNmZqlqA26z3
 mQpte+eIgFmTrnAprJ0ljT2lUefAFu0C1eSiqwaDgZ2B5VDtwPPuyxycOKRoCBScnUwp
 JYL5HsIiewrLtL8E6/jNbW//bBOCqjJw0AhPDiPoZyuF1UXRNDhsPqBL52GXQMujzqg3
 VbOfYH12eazJQ0LmSWSu9LrHuQjFGVfkRZezKLIJnCEo0bGwU8g5CVr1VeAjBVOzV6od
 YydA==
X-Gm-Message-State: ABy/qLaLjUmpl4+0R39fs4S7dG8Fuc6VprzsPp5L5SbJHpW6j/OeLA3F
 Qh3UN3we4i3DptSDFVgZGuvk6RHitf0=
X-Google-Smtp-Source: APBJJlGXiCAMMtbUP144aBh8o9NQcSqg+4ax7OrMdlFCQwWm5V6P4vm+CAhL/ayB/BKmt8eEYA2AtA==
X-Received: by 2002:a05:600c:2a4e:b0:3f9:b748:ff37 with SMTP id
 x14-20020a05600c2a4e00b003f9b748ff37mr5126529wme.20.1690667043018; 
 Sat, 29 Jul 2023 14:44:03 -0700 (PDT)
Received: from melissa.local ([2c0f:ef18:1431:0:b09:9616:db04:c248])
 by smtp.gmail.com with ESMTPSA id
 y17-20020a05600c20d100b003fba6709c68sm7311422wmm.47.2023.07.29.14.44.01
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 29 Jul 2023 14:44:02 -0700 (PDT)
References: <87mszebgwy.fsf@HIDDEN>
User-agent: mu4e 1.9.3; emacs 30.0.50
From: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Re: 30.0.50; The default auto-mode-interpreter-regexp does not
 match env with flags
Date: Sat, 29 Jul 2023 23:38:07 +0200
In-reply-to: <87mszebgwy.fsf@HIDDEN>
Message-ID: <878rays89s.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
Received-SPF: pass client-ip=2a00:1450:4864:20::329;
 envelope-from=wkirschbaum@HIDDEN; helo=mail-wm1-x329.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, 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-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

> A file without an extension will load ruby-mode if the first 
> line is:
>
>    #!/usr/bin/env ruby
>
> but not when the first line is:
>
>    #!/usr/bin/env -S ruby -e 'puts 123'
>
> Is there any reason why the latter should not be matched by the
> default
> `auto-mode-interpreter-regexp' value in 'files.el'?
>
>
> A more useful example I stumbled on today while working on a 
> language
> server after adding:
>
> `(add-to-list 'interpreter-mode-alist '("elixir" 
> . elixir-ts-mode))'
>
>
>    #!/usr/bin/env -S elixir --erl "-kernel standard_io_encoding
>      latin1"
>
>    Node.start(:"next-ls-#{System.system_time()}", :shortnames)
>    ....
>
>
>
> Wilhelm

This is a very naive solution to the above, but I am probably 
missing some
knowledge here and will break for anyone setting the var to 
something
custom.

modified   lisp/files.el
@@ -3243,7 +3243,7 @@ inhibit-local-variables-p
 
 (defvar auto-mode-interpreter-regexp
   (purecopy "#![ \t]?\\([^ \t\n]*\
-/bin/env[ \t]\\)?\\([^ \t\n]+\\)")
+/bin/env[ \t]\\)?\\(-\\{1,2\\}[a-zA-Z1-9=]+[ \t]+\\)?\\([^ 
\t\n]+\\)")
   "Regexp matching interpreters, for file mode determination.
 This regular expression is matched against the first line of a 
 file
 to determine the file's mode in `set-auto-mode'.  If it matches, 
 the file
@@ -3445,7 +3445,7 @@ set-auto-mode
 	 (setq mode (save-excursion
 		      (goto-char (point-min))
 		      (if (looking-at 
 auto-mode-interpreter-regexp)
-			  (match-string 2))))
+			  (match-string 3))))
 	 ;; Map interpreter name to a mode, signaling we're done 
 at the
 	 ;; same time.
 	 (setq done (assoc-default

modified   lisp/progmodes/sh-script.el
@@ -1481,7 +1481,7 @@ sh--guess-shell
   (cond ((save-excursion
            (goto-char (point-min))
            (looking-at auto-mode-interpreter-regexp))
-         (match-string 2))
+         (match-string 3))
         ((not buffer-file-name) sh-shell-file)
         ;; Checks that use `buffer-file-name' follow.
         ((string-match "\\.m?spec\\'" buffer-file-name) "rpm")




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#64939; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Jul 2023 20:29:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 29 16:29:31 2023
Received: from localhost ([127.0.0.1]:49063 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qPqZ9-0002FR-Kx
	for submit <at> debbugs.gnu.org; Sat, 29 Jul 2023 16:29:31 -0400
Received: from lists.gnu.org ([2001:470:142::17]:53248)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wkirschbaum@HIDDEN>) id 1qPqZ8-0002FF-2v
 for submit <at> debbugs.gnu.org; Sat, 29 Jul 2023 16:29:30 -0400
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 <wkirschbaum@HIDDEN>)
 id 1qPqZ2-0005Wl-Mp
 for bug-gnu-emacs@HIDDEN; Sat, 29 Jul 2023 16:29:24 -0400
Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <wkirschbaum@HIDDEN>)
 id 1qPqZ1-0000TC-9M
 for bug-gnu-emacs@HIDDEN; Sat, 29 Jul 2023 16:29:24 -0400
Received: by mail-lj1-x230.google.com with SMTP id
 38308e7fff4ca-2b9c0391749so49318281fa.0
 for <bug-gnu-emacs@HIDDEN>; Sat, 29 Jul 2023 13:29:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1690662561; x=1691267361;
 h=mime-version:message-id:date:subject:to:from:user-agent:from:to:cc
 :subject:date:message-id:reply-to;
 bh=m7SvUxKh2dKMsNFB24Bc/K/dB4OlluMoJxSkT7iKhpE=;
 b=IDCi1f4zDeYU9A4E0RhnIpx1djEyddgNnYU2WF91EVGelBX3QsdYKy+Zi8AXYzs0rr
 yuGBbuyiuaDbZhbGXyk7Y7C8imKHS1Ps3gix1qCS+kBGGj6ZY4jnmDEl95QIxtY8WOB6
 FQI3ZTR5+zRwfsdKtcHSe2GIVu2caefKVrVRpGTI8M2zPQHOI7iv4mdyZREy715wQEuM
 N3fhuiPeoiiaRIzZUle2pH7cXXmLplBm05xeP9GtGMGjeRguMmgzCCW0OgLoKbXL+RR9
 b7ExZSfGZyX/ijcE1Ewo1e0z8Wvd6LCs4kU6vQU+/YUG+uD9ibdfDGQIs8i0pWNfdHSI
 lLSw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1690662561; x=1691267361;
 h=mime-version:message-id:date:subject:to:from:user-agent
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=m7SvUxKh2dKMsNFB24Bc/K/dB4OlluMoJxSkT7iKhpE=;
 b=lJm3RfjH+YhN2Wv5TCR6EwUklis9y/2axG3t99SuBwFDORowqPHwNzCu1pGiQaOz06
 prsW6eOsI52/IHRSKnDN6FzSdnLMHyUe/beU2w6Q2ZBJutjOmwR3ie6HZeZO6JC6Ofwa
 g8o1gH7JNRMlPKVP7d0wRsRmZii+GGMb0WFfULluGjZANJ/xVOj00JbxKSEjkjOJTCtJ
 2YIuPME5mhG0Ac4uDAVN8sVZcwTlXykAp1gOSl8cEuGiCLCvmLMO3Ufk+CIR7pgtJTNp
 h+Hxnqk5pncDBTkWdyA1YjqJTyV0Zbc98vdtyEEoK+kDa6UCQZIMIA6VBirOizBuv3YL
 vt0A==
X-Gm-Message-State: ABy/qLZZhYGTPY00bmRwgAI/hZOZXMGcdxOgABHfJz0fdMw0FTLcVXQI
 wYiglEL5U2FwLOO31WB+zWLY8h4jO84=
X-Google-Smtp-Source: APBJJlHtZDt9xwxrtjCXu+PQvW0EMxST/qMocxCIj9thkIxMOM6B1qX23n0NQSAfCL7mxjyOEhbuHA==
X-Received: by 2002:a2e:7013:0:b0:2b9:5b46:2107 with SMTP id
 l19-20020a2e7013000000b002b95b462107mr4237728ljc.9.1690662561048; 
 Sat, 29 Jul 2023 13:29:21 -0700 (PDT)
Received: from melissa.local ([2c0f:ef18:1431:0:b09:9616:db04:c248])
 by smtp.gmail.com with ESMTPSA id
 n2-20020a05600c294200b003fbbe41fd78sm7254425wmd.10.2023.07.29.13.29.19
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 29 Jul 2023 13:29:20 -0700 (PDT)
User-agent: mu4e 1.9.3; emacs 30.0.50
From: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.50; The default auto-mode-interpreter-regexp does not match
 env with flags
Date: Sat, 29 Jul 2023 22:08:19 +0200
Message-ID: <87mszebgwy.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
Received-SPF: pass client-ip=2a00:1450:4864:20::230;
 envelope-from=wkirschbaum@HIDDEN; helo=mail-lj1-x230.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, 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-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


A file without an extension will load ruby-mode if the first line 
is:

    #!/usr/bin/env ruby

but not when the first line is:

    #!/usr/bin/env -S ruby -e 'puts 123'

Is there any reason why the latter should not be matched by the 
default
`auto-mode-interpreter-regexp' value in 'files.el'?


A more useful example I stumbled on today while working on a 
language
server after adding:

`(add-to-list 'interpreter-mode-alist '("elixir" 
. elixir-ts-mode))'


    #!/usr/bin/env -S elixir --erl "-kernel standard_io_encoding 
    latin1"

    Node.start(:"next-ls-#{System.system_time()}", :shortnames)
    ....



Wilhelm




Acknowledgement sent to Wilhelm Kirschbaum <wkirschbaum@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#64939; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 30 Jul 2023 05:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.