[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there something like `on-display-functions'?
From: |
Eli Zaretskii |
Subject: |
Re: Is there something like `on-display-functions'? |
Date: |
Wed, 27 Jan 2010 19:44:22 +0200 |
> Date: Wed, 27 Jan 2010 15:37:33 +0000
> From: Alan Mackenzie <address@hidden>
> Cc: Lennart Borgman <address@hidden>, address@hidden
>
> > I'd recommend you use jit-lock instead (via jit-lock-register), tho,
> > because fontification-functions (despite its name) really only works
> > well with a single function (at least I don't know how to make it work
> > well with more than one, based on how it's currently defined).
>
> Is that because it's got to set 'fontified' properties?
No, I don't think so. The handler of the `fontified' property checks
for the property's value being nil only once, and then runs all the
functions in fontification-functions in a loop. The relevant code is
below.
Stefan, could you perhaps show a reproducible test case for this?
----------------------------------------------------------------------
/* Get the value of the `fontified' property at IT's current buffer
position. (The `fontified' property doesn't have a special
meaning in strings.) If the value is nil, call functions from
Qfontification_functions. */
if (!STRINGP (it->string)
&& it->s == NULL
&& !NILP (Vfontification_functions)
&& !NILP (Vrun_hooks)
&& (pos = make_number (IT_CHARPOS (*it)),
prop = Fget_char_property (pos, Qfontified, Qnil),
/* Ignore the special cased nil value always present at EOB since
no amount of fontifying will be able to change it. */
NILP (prop) && IT_CHARPOS (*it) < Z))
{
int count = SPECPDL_INDEX ();
Lisp_Object val;
val = Vfontification_functions;
specbind (Qfontification_functions, Qnil);
if (!CONSP (val) || EQ (XCAR (val), Qlambda))
safe_call1 (val, pos);
else
{
Lisp_Object globals, fn;
struct gcpro gcpro1, gcpro2;
globals = Qnil;
GCPRO2 (val, globals);
for (; CONSP (val); val = XCDR (val))
{
fn = XCAR (val);
if (EQ (fn, Qt))
{
/* A value of t indicates this hook has a local
binding; it means to run the global binding too.
In a global value, t should not occur. If it
does, we must ignore it to avoid an endless
loop. */
for (globals = Fdefault_value (Qfontification_functions);
CONSP (globals);
globals = XCDR (globals))
{
fn = XCAR (globals);
if (!EQ (fn, Qt))
safe_call1 (fn, pos);
}
}
else
safe_call1 (fn, pos);
}
UNGCPRO;
}
unbind_to (count, Qnil);
- Is there something like `on-display-functions'?, Alan Mackenzie, 2010/01/27
- Re: Is there something like `on-display-functions'?, Lennart Borgman, 2010/01/27
- Re: Is there something like `on-display-functions'?, Alan Mackenzie, 2010/01/27
- Re: Is there something like `on-display-functions'?, Stefan Monnier, 2010/01/27
- Re: Is there something like `on-display-functions'?, Alan Mackenzie, 2010/01/27
- Re: Is there something like `on-display-functions'?,
Eli Zaretskii <=
- Re: Is there something like `on-display-functions'?, Stefan Monnier, 2010/01/27
- Re: Is there something like `on-display-functions'?, Eli Zaretskii, 2010/01/27
- Re: Is there something like `on-display-functions'?, Stefan Monnier, 2010/01/27
- Re: Is there something like `on-display-functions'?, Eli Zaretskii, 2010/01/28
- Re: Is there something like `on-display-functions'?, Stefan Monnier, 2010/01/28
- Re: Is there something like `on-display-functions'?, Eli Zaretskii, 2010/01/28
- Re: Is there something like `on-display-functions'?, Stefan Monnier, 2010/01/28
- Re: Is there something like `on-display-functions'?, Eli Zaretskii, 2010/01/29
- Re: Is there something like `on-display-functions'?, Stefan Monnier, 2010/01/29
- Re: Is there something like `on-display-functions'?, Eli Zaretskii, 2010/01/28