help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: does emacs regular expression support (?!expression)


From: Thien-Thi Nguyen
Subject: Re: does emacs regular expression support (?!expression)
Date: Sat, 04 Feb 2012 16:26:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

() Tim Landscheidt <tim@tim-landscheidt.de>
() Sat, 04 Feb 2012 10:12:33 +0000

   Thien-Thi Nguyen <ttn@gnuvola.org> wrote:

   >    > You can add a spec for ‘ErrorMode’, with default face, prior to this 
one.

   >    Which Emacs version does support that?

   > Any that processes these specs in the given order, with
   > "masking semantics", i suppose.  (I haven't tried.)

   What does:

   | (search-forward-regexp "\\([Ee][Rr][Rr]\\)\\(?!orMode\\)")

   give on your Emacs?

It throws an error "Invalid regular expression".
Sorry for being unclear.  Here is a reformulation:

"Presuming that Emacs processes the user-specified font-lock specs
in the order given and that once a piece of text is marked as 
fontified, it no longer qualifies for further processing,
one way to "not match ErrorMode but match "Err" is to specify first
"ErrorMode" with the default face (thus simulating "not matching"
and simultaneously making that text unavailable for...), and second
the "Err" with the warning face."

That is, two entries in the list, neither of which use ‘?:’.

So, instead of asking Emacs to look ahead on "Err" and decline to
match if the trailing text is "orMode", you ask Emacs to explicitly
find "ErrorMode" and (quietly) exclude it from future hits when
looking for "Err".  This is like sweeping the path with a glue gun.



reply via email to

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