Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite patterns for matching Vim/Emacs modelines
Both of the previous patterns had flawed handling of less obvious cases, such as wrongly accepting invalid modelines, or failing to match grammar that would otherwise be understood by Vim or Emacs. Emacs: * Boundaries now matched correctly to avoid matching "not-mode: nroff;" * Invalid modelines like "-*- nroff; -*-" are now ignored * Preceding variables containing asterisks are permitted * Semicolons are no longer required to separate modes from variables * Handling of malformed modelines better resembles Emacs's own behaviour Vim: * Version-specific modelines are now supported: "vim<200: ft=roff" * Preceding whitespace is required before "vim/ex" * Boolean options may now be listed before filetypes: "vi: noet ft=roff" * Escaped backslashes are handled properly; "vim: s=foo\ ft=cpp ft=roff"
- Loading branch information