Fix nix-mode for nix-shell shell scripts
Wasn't correctly detecting the interpreter argument for nix-shell shebangs. It must be done in two parts in case cached-nix-shell is used (which means the shebang will span 2+ lines).
This commit is contained in:
parent
56c5497a29
commit
15d85a5c74
1 changed files with 2 additions and 1 deletions
|
@ -53,7 +53,8 @@
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(if (not (re-search-forward "#! *\\(?:cached-\\)?nix-shell +-i +\\([^ \n]+\\)" 256 t))
|
(if (not (and (re-search-forward "\\_<nix-shell " (line-end-position 2) t)
|
||||||
|
(re-search-forward "-i +\"?\\([^ \"\n]+\\)" (line-end-position) t)))
|
||||||
(message "Couldn't determine mode for this script")
|
(message "Couldn't determine mode for this script")
|
||||||
(let* ((interp (match-string 1))
|
(let* ((interp (match-string 1))
|
||||||
(mode
|
(mode
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue