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

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

RE: Need Help on Whitespace-mode in Emacs 24.1.1


From: Drew Adams
Subject: RE: Need Help on Whitespace-mode in Emacs 24.1.1
Date: Sun, 26 Aug 2012 16:31:08 -0700

> > > http://www.emacswiki.org/emacs/download/font-menus-da.el
> > 
> > Thanks, Drew.  It works like a charm.  I now can have my cake 
> > and eat it too. :)
> 
> Hm.  I don't think it works like a charm yet.  So far, what I 
> uploaded does not work with recent Emacs versions (at least on
> Windows).  But I will soon upload something that does work.
> So stay tuned.

FYI - Should be OK now.

---

La petite histoire -

Font lock has changed a _lot_ since Emacs 21 (the last version for which this
code really worked, until now).

Among other things, in recent Emacs versions, `font-lock-set-defaults', the
function that is advised here, is called a zillion times when you turn on
font-locking, and most of those calls are in places outside the context that
should be advised here (i.e., within function `font-lock-fontify-level').

The result was that you could go down font-lock levels but you could not go back
up.  `font-lock-set-menu' was getting called (many times) outside the context
where `font-lock-maximum-decoration' was bound to the new level, so the level
was being treated as if it were `t' (maximum).

In Emacs 20/21, `font-lock-set-menu' was called only once.  Now it is called
many times in the course of switching levels (once).  Even by doing nothing for
most of those calls (since they are outside `font-lock-fontify-level', I make
them no-ops), it is still the case that the code gets repeated three times
(IIRC).  Not a big deal, but no doubt a slight waste.  At least it works again.

---

BTW, as I tried to explain on emacs-devel today, you need not treat the
so-called "levels" as levels of an amount of highlighting.  You can treat them
as just different highlighting patterns (not necessarily more or less
highlighting). 

IOW, you can cycle among "levels" 1, 2, 3, etc., but that need not mean
increasing or decreasing the amount of highlighting.  Think of the 1, 2, 3, etc.
the way you would think of switching among desktops or window configurations
that are numbered 1, 2, 3, etc.: they're just alternatives you can choose.




reply via email to

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