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

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

Conditional font locking


From: Ralf Angeli
Subject: Conditional font locking
Date: Tue, 04 May 2004 18:38:37 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Hello everybody,

is there a way to inhibit font locking or even use a different
fontification scheme if a certain condition is met?

Suppose you have the following LaTeX file:

\documentclass{article}
\begin{document}
Here is some text
\begin{verbatim}
\textbf{
\end{verbatim}
and here the text goes on.
\end{document}

A whole lot of text after the \textbf{ will be fontified bold.

Because verbatim-like environments can hold all sorts of things that
can confuse font locking, it would be a good idea to inhibit font
locking inside those environments.  Now what I am searching for is a
way to plug in the condition "if inside verbatim-like environment,
don't do font locking".

If you take this further and look e.g. at the `listings' package
which is able to nicely format code snippets of several programming
languages, it would be nice if you could not only say "stop
fontification in environment foo" but "do fontification according to
fontification scheme bar in environment foo".

Unfortunately I could not find an interface for such things in the
Elisp manual or in `font-lock.el'.

I am posting this here because I am not sure what category this
problem actually is.  A part of it is a bug report (because
`tex-mode.el' gets it wrong), another part is a plea for a pointer to
the right documentation in case the problem already is solved and even
another part is a request for enhancement of `font-lock.el' in case it
is not solved yet.  In case the problem is better suited for
emacs-devel or emacs-pretest-bug, please redirect.

-- 
Ralf


reply via email to

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