summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2024-02-10 17:56:57 +0100
committerEli Zaretskii <eliz@gnu.org>2024-02-17 10:31:47 +0200
commitc64e650fb346d92294703d22f8cd7deb7c47b49e (patch)
treebfe1f04bdbf67a87c4465cb4f34eb4be87dcc5cd /lisp/files.el
parentecb9641ecb5f42899042ff9c164ec7dbb8e166fe (diff)
downloademacs-c64e650fb346d92294703d22f8cd7deb7c47b49e.tar.gz
Support shebang lines with amended environment
For bug#64939. * lisp/files.el (auto-mode-interpreter-regexp): Account for possible VARIABLE=[VALUE] operands. * test/lisp/files-tests.el (files-tests-auto-mode-interpreter): Add an example from the coreutils manual.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 5098d49048e..524385edc84 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3274,12 +3274,15 @@ and `inhibit-local-variables-suffixes'. If
;; Optional group 1: env(1) invocation.
"\\("
"[^ \t\n]*/bin/env[ \t]*"
- ;; Within group 1: possible -S/--split-string.
+ ;; Within group 1: possible -S/--split-string and environment
+ ;; adjustments.
"\\(?:"
;; -S/--split-string
"\\(?:-[0a-z]*S[ \t]*\\|--split-string=\\)"
;; More env arguments.
"\\(?:-[^ \t\n]+[ \t]+\\)*"
+ ;; Interpreter environment modifications.
+ "\\(?:[^ \t\n]+=[^ \t\n]*[ \t]+\\)*"
"\\)?"
"\\)?"
;; Group 2: interpreter.