emacs-devel
[Top][All Lists]
Advanced

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

Re: kill ring menu


From: Colin Walters
Subject: Re: kill ring menu
Date: 06 May 2002 01:15:01 -0400

Since we're apparently moving this discussion to emacs-devel, I'll give
some context:

One of the things Richard commented on was how my proposed
browse-kill-ring patch used font-lock for fontification.  He suggested
to apply the faces when the buffer was constructed, and that using
font-lock was wasteful.

However, I think there is a more general and useful paradigm for
fontification in special modes.  What I do in that patch (and also in
ibuffer and the new occur-mode) is to apply a special text property (say
'occur-match) to areas of text, and then set up a
`font-lock-fontify-region-function' which then searches for those text
properties and applies faces.

If the user never turns on font-lock-mode, then no fontification will
occur, and font-lock.el will never be loaded.  If they do, then things
will automagically be fontified.

For example, in the new Occur implementation, you can switch to the
*Occur* buffer and type 'M-x font-lock-mode' to toggle fontification on
and off, and it will Just Work.  The same is true for ibuffer.

On Sun, 2002-05-05 at 13:46, Richard Stallman wrote:

> That might be a valid point.  It raises the question: whether it is
> better, in these modes that construct special text and can highlight
> it, to enable its highlighting by default, or to make it controllable
> with M-x font-lock-mode.

Well, these are two separate issues.  If we make things controllable via
M-x font-lock-mode, then the user can choose whether or not to enable
highlighting by default through the usual font-lock mechanisms, such as
the functions `global-font-lock-mode', and `font-lock-mode', as well as
the variable `font-lock-global-modes', etc.

> In the past we've acted on the view that it is better to highlight
> these buffers by default, and the expectation that a considerable
> fraction of users won't use Font-Lock mode but will benefit from
> highlighting these special buffers.

I assert (without any statistics) that the vast majority of users put
(global-font-lock-mode 1) in their ~/.emacs file (thereby loading
font-lock.el), and expect fontification in every mode, while the
remaining portion don't want any fontification at all.  So in almost all
cases, there is no waste, because font-lock.el will already be loaded,
or will be used by other modes.






reply via email to

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