[Top][All Lists]

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

Re: kill ring menu

From: Richard Stallman
Subject: Re: kill ring menu
Date: Thu, 9 May 2002 18:30:02 -0600 (MDT)

    An example of where this won't work is with an *Occur* buffer, if the
    user just wants to temporarily turn on/off fontification, but has killed
    the associated buffer(s).  The occur command will fail in this case.

    A somewhat similar situation could happen with a *Kill Ring* buffer; if
    the user has done more killing before typing M-x font-lock-mode, then
    the entry they want to see unfontified could have been rotated off the
    kill ring.

That is a good point.  There needs to be a way for these modes to
specify how to add and remove fonts in the buffer.

But these should not have to use the whole font-lock-mode mechanism,
even if they use M-x font-lock-mode as a control interface to enable
and disable.  It should be possible to specify other functions
to do the job.

The easiest way to implement these functions will often be to use
a category property.  Then these functions can simply change the
properties of the category, and faces will appear or disappear all thru
the buffer.

In fact, it might make sense to have a buffer-local variable
font-lock-category-alist whose elements look like (CATEGORY-SYMBOL .
FACE-PROP).  If that is non-nil, turning on font-lock-mode just does

  (dolist (elt font-lock-category-alist)
    (put (car elt) 'face (cdr elt)))

and turning it off just does

  (dolist (elt font-lock-category-alist)
    (put (car elt) 'face nil))

reply via email to

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