GNU bug report logs - #56682
Fix the long lines font locking related slowdowns

Previous Next

Package: emacs;

Reported by: Gregory Heytings <gregory <at> heytings.org>

Date: Thu, 21 Jul 2022 18:01:01 UTC

Severity: normal

Done: Gregory Heytings <gregory <at> heytings.org>

Bug is archived. No further changes may be made.

Full log


Message #2076 received at 56682 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 56682 <at> debbugs.gnu.org
Subject: Re: feature/improved-locked-narrowing 9dee6df39c: Reworked locked
 narrowing.
Date: Fri, 30 Dec 2022 16:38:34 +0000
[Moved to the bug tracker.]

Thanks for your comments, Stefan!

>
> - I don't see any mention of those new features in etc/NEWS.
>

Yes, that's something I still need to do.

>
> - I can't think of a case where a piece of code could/should make use of 
> `narrowing-unlock`.
>

I don't understand what you mean by that.  'narrowing-lock' locks a 
narrowing, and is used e.g. in the 'with-narrowing' macro. 
'narrowing-unlock' can be used to unlock a narrowing.

>
> - In `nlinum--line-number-at-pos`, I want to circumvent the narrowing 
> lock due to long lines (since its performance is only affected by buffer 
> size but not by line length), but I can't see how to do that. The only 
> primitive I see which would let me get out of the locked narrowing is 
> `narrowing-unlock` but:
>
> - I don't know which tag(s) to use.
>

That depends on the place where 'nlinum--line-number-at-pos' is called, or 
IOW where/by which function the narrowing was locked, or IOW again which 
tag was used to unlock the narrowing.

>
> - I don't want to remove the lock, I only want to circumvent it 
> temporarily, and I can't see how to re-install a lock after removing it 
> (`narrowing-lock` doesn't fit the bill because I don't know the bounds 
> of the lock and because that would not preserve the stacking order of 
> locks).
>

That's part of the improvements you suggested, and I implemented.  Simply 
do a:

(save-restriction
  (narrowing-unlock 'the-appropriate-tag)
  (widen)
  ... your code ...)

Upon return from the save-restriction, the narrowing locks are restored.





This bug report was last modified 2 years and 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.