unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51899: Odd highlighting in compilation mode
@ 2021-11-16 17:13 積丹尼 Dan Jacobson
  2021-11-16 21:31 ` Kévin Le Gouguec
  0 siblings, 1 reply; 4+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-11-16 17:13 UTC (permalink / raw)
  To: 51899

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

Save and open the attached file with emacs -Q.
You will see:
One $m is highlighted, the others and $i etc. aren't.
"/tmp/$(basename" is highlighted.


[-- Attachment #2: test file --]
[-- Type: application/octet-stream, Size: 589 bytes --]

-*- mode: compilation; default-directory: "~/" -*-
Compilation started at Wed Nov 17 01:06:26

make -n
mountpoint -q /cf/
set -xe; m=/cf/versions-$(hostname);\
if test $m -nt /var/lib/dpkg/status && test \
$m -nt /var/lib/aptitude/pkgstates; then exit; fi;\
apt-show-versions | grep -v 'not installed$' > /tmp/VERsions;\
test -s /tmp/VERsions;\
sort -o $m /tmp/VERsions || { echo try again as root first; false;}
: ${k?}
for i in /cf/versions-jidanni[]; do sed 's/:.*//' $i | sort -o /tmp/$(basename $i); done;\
comm -3 /tmp/versions-jidanni[]

Compilation finished at Wed Nov 17 01:06:26

[-- Attachment #3: Type: text/plain, Size: 92 bytes --]


I have no opinions on what should be highlighted. Just be consistent.
emacs-version "27.1"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#51899: Odd highlighting in compilation mode
  2021-11-16 17:13 bug#51899: Odd highlighting in compilation mode 積丹尼 Dan Jacobson
@ 2021-11-16 21:31 ` Kévin Le Gouguec
  2021-11-16 21:39   ` Kévin Le Gouguec
  2021-11-17  8:09   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: Kévin Le Gouguec @ 2021-11-16 21:31 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 51899

積丹尼 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".





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#51899: Odd highlighting in compilation mode
  2021-11-16 21:31 ` Kévin Le Gouguec
@ 2021-11-16 21:39   ` Kévin Le Gouguec
  2021-11-17  8:09   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Kévin Le Gouguec @ 2021-11-16 21:39 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 51899

Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:

>> 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".

That could have been phrased less ambiguously, although hopefully the
rest of the message made it clear that by "outputs of the compilation
process" I meant "filenames of build artifacts, typically given as
arguments of -o/--output options".





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#51899: Odd highlighting in compilation mode
  2021-11-16 21:31 ` Kévin Le Gouguec
  2021-11-16 21:39   ` Kévin Le Gouguec
@ 2021-11-17  8:09   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-17  8:09 UTC (permalink / raw)
  To: Kévin Le Gouguec; +Cc: 51899, 積丹尼 Dan Jacobson

Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:

> 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.

Yeah, I think it's way outside the remit of compilation mode to parse
stuff like this -- a makefile can basically output anything, in any
language.  Shells are the most popular, but...

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-17  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 17:13 bug#51899: Odd highlighting in compilation mode 積丹尼 Dan Jacobson
2021-11-16 21:31 ` Kévin Le Gouguec
2021-11-16 21:39   ` Kévin Le Gouguec
2021-11-17  8:09   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).