[Top][All Lists]

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

Re: Major modes using `widen' is a good, even essential, programming pra

From: Alan Mackenzie
Subject: Re: Major modes using `widen' is a good, even essential, programming practice.
Date: Sun, 7 Aug 2022 14:13:36 +0000

Hello, Gregory.

On Sun, Aug 07, 2022 at 13:31:05 +0000, Gregory Heytings wrote:

> > Major modes, like all Emacs Lisp programs, have, by design, access to 
> > the full range of Emacs's facilities.  Should it make your task more 
> > difficult (and I don't see that it does), that's your problem, not the 
> > major modes' maintainers'.

> I fear it is not my problem, no.

> jit-lock-functions is an API, with a contract.  CC Mode decided to break 
> that contract.

Where, exactly are the terms of this supposed contract formulated?  And
which part of this supposed contract has CC Mode broken?

I suspect that this "contract" is something implicit you have in your
understanding of Emacs, shared by some other people, and that you have
assumed that everybody else shares that understanding.  Such conflicts
have occurred before.

> It is wrong that "arbitrary Lisp can be executed through
> fontification-functions", as you said earlier.

It is not wrong.  If you disagree, point out where, say in the Elisp
manual, these restrictions are imposed.

> A function called from fontification-functions isn't supposed to
> download a file, or to send an email, or to change a user option, or
> to remove or create a file, or to remove or insert text in the buffer,
> or to kill Emacs or a frame or a window or the current buffer, or to
> change the window layout, and so on and so forth.

That doesn't deserve a reply, so won't be getting one.

> So far breaching that contract has not posed major problems, except of 
> course for CC Mode users, who had to bear its sluggishness.  We now have a 
> new feature which assumes, and rightly so, that this contract is obeyed. 

This new feature deliberately breaks contracts, in particular the
definitions of widen and narrow-to-region.  That will, sooner or later,
break existing code.  Maybe this is necessary, but having read the bug
threads, I didn't notice much effort being put into preserving these

If you find CC Mode too sluggish for you (I don't), then configure it to
be faster and inaccurate by setting font-lock-maximum-decoration.

> This breaks CC Mode.

CC Mode will cope.

> >From where I stand, there are two options here: either CC Mode disables 
> the new feature (which is, on purpose, 100% backward compatible), or CC 
> Mode is fixed to obey the jit-lock-functions contract, and to become 
> compatible with the new feature (which will likely also, by side-effect 
> and as a bonus, fix the aforementioned sluggishness).

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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