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:
Henrik Lissner 2021-02-02 04:48:03 -05:00
parent 56c5497a29
commit 15d85a5c74

View file

@ -53,7 +53,8 @@
(save-excursion
(goto-char (point-min))
(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")
(let* ((interp (match-string 1))
(mode