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

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

Re: font-lock and text mode


From: Oliver Scholz
Subject: Re: font-lock and text mode
Date: Mon, 24 Feb 2003 16:19:52 +0100
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50

kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> Oliver Scholz <alkibiades@gmx.de> writes:
>
>> I noticed that `hi-lock-mode' doesn't work properly in text mode (CVS
>> Emacs): after I have added a regexp with `C-x w h', matches already
>> in the buffer are highlighted, but matching text that I insert after
>> that is not.
>
> I think it works as intended.

I don't know for sure, of course, but I don't think
so. `highlight-regexp' adds to `font-lock-keywords'. So in every mode
that comes with font-lock support, text that matches the regexp is
highlighted even if it was typed _after_ defining the regexp.  For
example in `lisp-interaction-mode':

emacs -q --no-site-file

M-x hi-lock-mode RET
C-x w h hello RET RET
hello

But:

C-x b *tmp* RET
M-x text-mode RET
C-x w h hello RET RET
hello

>> Also it seems to be impossible to add highlighting via
>> font-lock-keywords to text mode.
>>
>> (font-lock-add-keywords nil 
>>                         '(("\\<lirum larum\\>" . font-lock-warning-face)))
>>
>> I tried a lot to find the reason for this.
>
> I think the deeper reason is that text-mode has no font-lock support.

Yes, but how do I add it "manually"? (I mean: without modifying
text-mode itself.)

> Maybe it is easiest to just use your derived mode.

Well, actually I think this is a bug in `hi-lock-mode' and I want to
fix it.

And even if there is an easy workaround, I'd like to understand the
deeper mysteries of the Mighty Font Lock.

    Oliver
-- 
6 Ventôse an 211 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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