stank icon indicating copy to clipboard operation
stank copied to clipboard

funk: Option to encourage vi and emacs modelines

Open mcandre opened this issue 5 years ago • 0 comments

Modelines can help many text editors to better highlight scripts, reducing the need for users to configure their text editors.

When file extensions / shebangs / mimetypes are insufficient or ambiguous, such as for *.sql (PostgreSQL or MySQL or MSSQL or POSIX SQL or...), *.m (MATLAB or Objective C), *.pl (Perl or crusty old Pascal) files, then modelines are especially helpful to disambiguate the exact language involved.

On the one hand, many environments are about 80% effective at highlighting random programming scripts. Custom user configuration and/or modelines tend to help plug this gap.

On the other hand, some environments actually bork on modelines, presenting annoying warnings when modelines are present in files. That is why such a rule should be optional, off by default.

The rule should encourage modelines for both vi and for emacs, as the userbase is a motley mix of these two. Need to research how nano/pico react to modelines, if at all.

To keep the implementation code simple, we can borrow funk's IFS, set concept and check for the existence of a vi modeline and an emacs modeline, without being fussy about the contents of these modelines.

We can call this rule -modelines.

mcandre avatar May 18 '20 23:05 mcandre