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.
This commit is contained in:
parent
ecb9641ecb
commit
c64e650fb3
2 changed files with 7 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -1694,7 +1694,9 @@ set to."
|
|||
(files-tests--check-shebang "#!/usr/bin/env -S-vi bash -eux" 'sh-base-mode 'bash)
|
||||
(files-tests--check-shebang "#!/usr/bin/env -ivS --default-signal=INT bash -eux" 'sh-base-mode 'bash)
|
||||
(files-tests--check-shebang "#!/usr/bin/env -ivS --default-signal bash -eux" 'sh-base-mode 'bash)
|
||||
(files-tests--check-shebang "#!/usr/bin/env -vS -uFOOBAR bash -eux" 'sh-base-mode 'bash))
|
||||
(files-tests--check-shebang "#!/usr/bin/env -vS -uFOOBAR bash -eux" 'sh-base-mode 'bash)
|
||||
;; Invocation through env, with modified environment.
|
||||
(files-tests--check-shebang "#!/usr/bin/env -S PYTHONPATH=/...:${PYTHONPATH} python" 'python-base-mode))
|
||||
|
||||
(ert-deftest files-test-dir-locals-auto-mode-alist ()
|
||||
"Test an `auto-mode-alist' entry in `.dir-locals.el'"
|
||||
|
|
Loading…
Add table
Reference in a new issue