Skip to content

Commit d9c1baf

Browse files
committed
Update modeline patterns to use github-linguist/linguist#5271
1 parent b18cf7c commit d9c1baf

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org).
99
[Unpublished]
1010
------------------------------------------------------------------------
1111
* __Added:__ Comment highlighting for interpreter directives (hashbangs)
12+
* __Fixed:__ [Various inaccuracies][1] related to modeline matching
13+
14+
[1]: https://github.com/github/linguist/pull/5271
1215

1316

1417

grammars/emacs-lisp.cson

+9-7
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@ firstLineMatch: """(?x)
2121
(?:$|\\s)
2222
|
2323
# Modeline
24-
(?i:
24+
(?:
2525
# Emacs
26-
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
27-
emacs-lisp
28-
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
26+
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
27+
(?i:emacs-lisp)
28+
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
2929
|
3030
# Vim
31-
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
32-
(?:emacs-lisp|elisp)
33-
(?=\\s|:|$)
31+
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
32+
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
33+
(?:filetype|ft|syntax)[ \\t]*=
34+
(?i:emacs-lisp|elisp)
35+
(?=$|\\s|:)
3436
)
3537
"""
3638
patterns: [{

grammars/muse.cson

+9-7
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ patterns: [{
1919
end: "(?=A)B"
2020
patterns: [include: "#main"]
2121
}]
22-
firstLineMatch: """(?ix)
22+
firstLineMatch: """(?x)
2323
2424
# Emacs modeline
25-
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
26-
muse
27-
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
25+
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
26+
(?i:muse)
27+
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
2828
2929
|
3030
3131
# Vim modeline
32-
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
33-
muse
34-
(?=\\s|:|$)
32+
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
33+
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
34+
(?:filetype|ft|syntax)[ \\t]*=
35+
(?i:muse)
36+
(?=$|\\s|:)
3537
"""
3638

3739
repository:

grammars/yasnippet.cson

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ fileTypes: [
44
"yasnippet"
55
"yas"
66
]
7-
firstLineMatch: """(?xi)
7+
firstLineMatch: """(?x)
88
# Emacs modeline
9-
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
10-
(?:yasnippet|snippet)
11-
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
9+
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
10+
(?i:yasnippet|snippet)
11+
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
1212
"""
1313

1414
patterns: [{

0 commit comments

Comments
 (0)