Skip to content

Commit

Permalink
feat: add support for emacs file mode line with mode:
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Feb 27, 2024
1 parent f23778e commit c74f4ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/functions.sh
Expand Up @@ -142,7 +142,7 @@ has_shebang () {
fi

# Emacs mode detection
if grep --quiet -E '^\s*#.*\s+-\*-\s+(sh|ash|bash|dash|ksh|bats|shell-script)\s+-\*-\s*' "${file}"; then
if grep --quiet -E '^\s*#.*\s+-\*-\s+(mode:\s+)?(sh|ash|bash|dash|ksh|bats|shell-script)\s+-\*-\s*' "${file}"; then
return 0
fi

Expand Down
2 changes: 1 addition & 1 deletion test/has_shebang.bats
Expand Up @@ -250,7 +250,7 @@ setup () {
' # -*- sh -*-'
' # -*- sh -*-'
' # -*- sh -*- ... ...'
'# systemd-sysext(8) completion -*- shell-script -*-'
'# systemd-sysext(8) completion -*- mode: shell-script -*-'
)
local emacs_incorrect=(
' -*- sh -*-'
Expand Down

0 comments on commit c74f4ed

Please sign in to comment.