From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64939: 30.0.50; The default auto-mode-interpreter-regexp does not match env with flags Date: Sun, 30 Jul 2023 07:53:42 +0300 Message-ID: <83zg3eknjd.fsf@gnu.org> References: <87mszebgwy.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27924"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64939@debbugs.gnu.org To: Wilhelm Kirschbaum Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 30 07:20:14 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 1qPyqj-00076P-Ql for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Jul 2023 07:20:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPyRP-000849-Ur; Sun, 30 Jul 2023 00:54:03 -0400 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 1qPyRO-00083x-13 for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 00:54:02 -0400 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 1qPyRN-0004WM-PM for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 00:54:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qPyRN-00061w-ML for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 00:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Jul 2023 04:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64939 X-GNU-PR-Package: emacs Original-Received: via spool by 64939-submit@debbugs.gnu.org id=B64939.169069283423167 (code B ref 64939); Sun, 30 Jul 2023 04:54:01 +0000 Original-Received: (at 64939) by debbugs.gnu.org; 30 Jul 2023 04:53:54 +0000 Original-Received: from localhost ([127.0.0.1]:49163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPyRG-00061b-G2 for submit@debbugs.gnu.org; Sun, 30 Jul 2023 00:53:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35864) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPyRB-00061M-S2 for 64939@debbugs.gnu.org; Sun, 30 Jul 2023 00:53:52 -0400 Original-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 ) 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==; Original-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 ) id 1qPyR5-0000fh-Pz; Sun, 30 Jul 2023 00:53:44 -0400 In-Reply-To: <87mszebgwy.fsf@gmail.com> (message from Wilhelm Kirschbaum on Sat, 29 Jul 2023 22:08:19 +0200) 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:266350 Archived-At: > From: Wilhelm Kirschbaum > 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?