unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 51899@debbugs.gnu.org
Subject: bug#51899: Odd highlighting in compilation mode
Date: Tue, 16 Nov 2021 22:31:42 +0100	[thread overview]
Message-ID: <87v90rpz29.fsf@gmail.com> (raw)
In-Reply-To: <87wnl8hvle.8.fsf@jidanni.org> ("積丹尼 Dan Jacobson"'s message of "Wed, 17 Nov 2021 01:13:49 +0800")

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





  reply	other threads:[~2021-11-16 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 17:13 bug#51899: Odd highlighting in compilation mode 積丹尼 Dan Jacobson
2021-11-16 21:31 ` Kévin Le Gouguec [this message]
2021-11-16 21:39   ` Kévin Le Gouguec
2021-11-17  8:09   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v90rpz29.fsf@gmail.com \
    --to=kevin.legouguec@gmail.com \
    --cc=51899@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).