* Conditional font locking
@ 2004-05-04 16:38 Ralf Angeli
2004-05-04 16:50 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Ralf Angeli @ 2004-05-04 16:38 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Conditional font locking
2004-05-04 16:38 Conditional font locking Ralf Angeli
@ 2004-05-04 16:50 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2004-05-04 16:50 UTC (permalink / raw)
> 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),
IIUC this is with Emacs-CVS, so please report this bug to
emacs-pretest-bug@gnu.org. We're in feature freeze so bug-fixing is
quite fashionable.
> 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.
It's not solved yet. The "solutions" right now are just completely ad-hoc
and specific to each case, basically. Even the `verbatim' handling is
a really ugly hack. I've been toying with ideas for improving font-lock
to deal with such things (basically dealing with multiline thingies, tho
the way font-lock-multiline does it is completely insufficient: a notion of
"state" has to be added, as you suggest) but nothing's come out of it yet.
> In case the problem is better suited for emacs-devel or emacs-pretest-bug,
> please redirect.
emacs-devel@gnu.org is the right place for discussions.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-05-04 16:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-04 16:38 Conditional font locking Ralf Angeli
2004-05-04 16:50 ` Stefan Monnier
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.