all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: font-lock and text mode
Date: Mon, 24 Feb 2003 16:19:52 +0100	[thread overview]
Message-ID: <un0kln1t3.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: 84lm05vlji.fsf@lucy.is.informatik.uni-duisburg.de

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	other threads:[~2003-02-24 15:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-24 12:40 font-lock and text mode Oliver Scholz
2003-02-24 13:46 ` Kai Großjohann
2003-02-24 15:19   ` Oliver Scholz [this message]
2003-02-24 17:21     ` Kai Großjohann
2003-02-24 14:10 ` John Paul Wallington
2003-02-24 15:21   ` Oliver Scholz

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

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

  git send-email \
    --in-reply-to=un0kln1t3.fsf@ID-87814.user.dfncis.de \
    --to=alkibiades@gmx.de \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.