emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 5c70ff9: New user option 'font-lock-ignore'


From: Stefan Monnier
Subject: Re: master 5c70ff9: New user option 'font-lock-ignore'
Date: Sat, 02 Apr 2022 10:06:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>> The symbol is interpreted as a glob
>> +pattern; in particular, @code{*} matches everything.
> Do you mean shell glob patterns?  AFAIK, we don't use them in Emacs
> except for shell wildcards, so why are they used here?

A bit of history: originally his code only supported `*` and I suggested
the use of `wildcard-to-regexp` to both simplify the code, be more
general, and simplify the doc since we can just say "glob pattern" which
is a known concept.

> why not regexps?

I did not suggest the use of regexps because I felt that regexps written
as symbols could be problematic (especially the `.` being a second-class
citizen among symbol constituents in ELisp).  Admittedly, in practice
`.` works fine (i.e. without backslash-escaping) in most places in
a symbol so maybe it wouldn't be that bad.

My gut tells me that globs are preferable here (slightly less verbose
and slightly less odd):

    (typer-mode foo-*-baz)

vs

    (typer-mode \\\`foo-.*-baz\\\')

But either way is fine by me (we can make the \\\` anchoring \\\' implicit).

> And in any case, those patterns need a thorough description,
> since we don't use them elsewhere.  For example, the way to quote
> meta-characters such as '*' must be documented, because it isn't
> self-evident.

AFAIK glob patterns come with their own standard way to escape,
e.g. `foo[*]bar`, tho admittedly to make it into a single symbol you need
to write it as `foo\[*\]bar` :-(


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]