[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51899: Odd highlighting in compilation mode
From: |
Kévin Le Gouguec |
Subject: |
bug#51899: Odd highlighting in compilation mode |
Date: |
Tue, 16 Nov 2021 22:31:42 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:
> "/tmp/$(basename" is highlighted.
Yup, I guess that's due to this bit this from
compilation-mode-font-lock-keywords:
> (" --?o\\(?:utfile\\|utput\\)?[= ]\\(\\S +\\)" . 1)
The heuristic, I guess, is "highlight things that look like output
arguments". Maybe it could do with a smarter font-lock matcher?
I'm not knowledgeable enough with font-lock to see how that could work;
I think we'd want to skip over the --?o\\(?:utfile\\|utput\\)?[= ] part,
then match everything that we find by forward-sexp'ing until
(char-after) matches [ ;&|] (or we hit "no next sexp")? No idea if
that's expressible with font-lock matchers.
> One $m is highlighted, the others and $i etc. aren't.
compilation-mode mostly expects command outputs, not shell scripts
sources, so I don't know how much shell syntax we want the mode to
highlight by default.
The font-lock rule discussed above does show we expect some shell
commands, but compilation-mode seems more concerned with bits relevant
to the compilation process (i.e. here, the output files) than with shell
syntax in general.
> I have no opinions on what should be highlighted. Just be consistent.
The consistency compilation-mode aims for, IIUC, is "highlight outputs
of the compilation process".