[Pkg-mc-devel] Bug#844212: Bug#844212: mc: improved syntax detections for sh, perl, makefile and m4
Jonas Smedegaard
dr at jones.dk
Sun Nov 13 17:22:46 UTC 2016
Hi Yury,
Quoting Yury V. Zaytsev (2016-11-13 16:49:13)
> On Sun, 13 Nov 2016, Jonas Smedegaard wrote:
>> Similar patterns likely makes sense to expand to other syntaxes as well.
>
> In the future, please post such patches directly to the upstream bug
> tracker; they are not Debian-specific, and all you gonna get out of
> posting them to the Debian bug tracker is a few months to a few years
> delay in getting them upstreamed.
Ok - and thanks for your swift response!
I can recommend to add a reportbug hook to warn bugreporters that such
severe bitrot is to be expected.
Should I file a separate wishlist bugreport about that?
>> Attached is a patch for improved syntax detections for sh, perl,
>> makefile and m4.
>
> I've committed the *.t thing, but your regexes scare the hell out of me.
>
> I understand that these ones are some kind of editor tags, but I'm not
> sure what they are actually supposed to match:
>
> -\\\*-\s\*(.\*;)?(mode:\s)?.\*(sh|shell-script)(;.\*)?\s-\\\*-
> -\\\*-\s\*(.\*;)?mode:\smakefile(;.\*)?\s-\\\*-)
> -\\\*-\s\*(.\*;)?(mode:\s)?.\*Autotest(;.\*)?\s-\\\*-
It is emacs-style hint, with \ and * backtick-escaped:
https://codesearch.debian.net/search?q=-%5C*-%5Cs*%28.*%3B%29%3F%28mode%3A%5Cs%29%3F.*%28sh%7Cshell-script%29%28%3B.*%29%3F%5Cs-%5C*-
Examples:
# -*- Mode: sh; tab-width: 4; indent-tabs-mode: t -*-
# This is a -*- sh -*-
> Besides, the whole composition is somehow weird and inconsistent:
>
> ^#\s\*(!\s\*(/usr/bin/)?make|-\\\*-\s\*(.\*;)?mode:\smakefile(;.\*)?\s-\\\*-)
> ^ spaces in shebang?!
Intended: Emacs style commonly contains spaces, (even hashbang style
uncommonly does too, I believe):
https://codesearch.debian.net/search?q=%5E%23%5Cs*%28%21%5Cs*%28%5C%2Fusr%5C%2Fbin%5C%2F%29%3Fmake%7C-%5C*-%5Cs*%28.*%3B%29%3Fmode%3A%5Csmakefile%28%3B.*%29%3F%5Cs-%5C*-%29
> ^ why this is optional?!
Because it is in the wild:
https://codesearch.debian.net/search?q=%5E%23%5Cs*%21%5Cs*make
> ^#\s\*!\s\*(/usr/bin/)?m4|-\\\*-\s\*(.\*;)?(mode:\s)?.\*Autotest(;.\*)?\s-\\\*-
> ^ no parens unlike above?!
>
> ^#!\s\*/(.\*/|usr/bin/env\s)([a-z]?|ba|pdk)sh|-\\\*-\s\*(.\*;)?(mode:\s)?.\*(sh|shell-script)(;.\*)?\s-\\\*-
> ^ can't be a valid script
Again, that is emacs hint. Only when executable bit is set do the
initial line need to be a hashbang - files included or in other ways
used indirectly need not.
> I'm sorry, but I think this is unfit to be committed.
If not because you made wrong assumptions now clarified, please
elaborate why.
- Jonas
--
* Jonas Smedegaard - idealist & Internet-arkitekt
* Tlf.: +45 40843136 Website: http://dr.jones.dk/
[x] quote me freely [ ] ask before reusing [ ] keep private
More information about the Pkg-mc-devel
mailing list