[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Highlight a word
From: |
Felix Natter |
Subject: |
Re: Highlight a word |
Date: |
Mon, 01 Sep 2003 14:22:44 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
Matthias Teege <matthias@mteege.de> writes:
> Moin,
>
> I've write a function which made some tests on each word in a
> buffer or region and returns t or nil. Now I want to highlight the
> words where the function returns t.
>
> There is no highlight-region or highlight-word function in
> emacs. What is the best way to do somthing like that?
you can use overlays in GNU Emacs and extents in XEmacs:
i.e. GNU Emacs 20 and above:
(setq ol (make-overlay 1 25))
(overlay-put ol 'face font-lock-keyword-face)
(delete-overlay ol)
example for XEmacs (can't test this):
(setq extent (make-extent nil nil))
(set-extent-face extent po-highlight-face)
(set-extent-endpoints extent 1 25 (current-buffer))
you can find sample code for overlays+extents in po-mode.el
ftp://ftp.gnu.org/gnu/gettext/gettext-0.12.1.tar.gz
(in gettext-0.12.1/gettext-tools/misc/po-mode.el)
--
Felix Natter
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Highlight a word,
Felix Natter <=