GNU bug report logs - #28850
26.0.90; Error running timer 'jit-lock-stealth-fontify': (error "Invalid search bound (wrong side of point)")

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sun, 15 Oct 2017 16:09:01 UTC

Severity: normal

Found in versions 27.0.50, 26.0.90

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


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

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: contovob <at> tcd.ie, 28850 <at> debbugs.gnu.org
Subject: Re: bug#28850: 26.0.90; Error running timer
 'jit-lock-stealth-fontify': (error "Invalid search bound (wrong side of
 point)")
Date: Sun, 5 May 2019 09:06:22 +0000
Hello, Eli.

On Sat, May 04, 2019 at 16:36:36 +0300, Eli Zaretskii wrote:
> > Date: Sat, 4 May 2019 12:41:02 +0000
> > Cc: contovob <at> tcd.ie, 28850 <at> debbugs.gnu.org
> > From: Alan Mackenzie <acm <at> muc.de>
> > 
> > However, that nil clearly did happen, so I'll be spending some time
> > working out how it could have happened, and amending
> > c-beginning-of-statement-1 accordingly, whether with your ad-hoc patch
> > or otherwise.

> Thanks in advance.  Looking forward to seeing the fix in Emacs near
> me.

I have a hypothesis and a patch.

The code at this point in c-beginning-of-statement-1 is in a loop, where
it goes back a sexp at a time, checking for end of statement after each
going back.  (Note, the most immediate `while' isn't this loop.)

If that sexp was a paren block, the code checks for a statement boundary
between just before the terminating paren and the starting point for the
sexp movement.  However, having gone back over this paren block, it
would be a waste of time to step forward over it again, so the function
notes the starting point in the variable before-sws-pos ("sws" =
"syntactic whitespace").  This before-sws-pos is the argument to the
c-down-list-backward which shouldn't return nil.

This goes wrong if there's a macro between the sexp starting point and
the closing paren.  The c-down-list-backward then moves into the macro
(if there's a paren there), and we have nonsense.

That's the theory.  The fix, which is now obvious, is to (setq
before-sws-pos ...) after moving back over a macro.  Perhaps I should
check the result of c-down-list-backward too, but that's to be done
after checking the current fix.

I can't actually test this myself, so would you please try out the patch
below in your test setup, and let me know whether it fixes this nasty
bug.

Thanks!


diff -r 13a9cf53cd4d cc-engine.el
--- a/cc-engine.el	Thu May 02 20:41:32 2019 +0000
+++ b/cc-engine.el	Sun May 05 08:40:14 2019 +0000
@@ -1148,6 +1148,9 @@
 			 ;; Have we moved into a macro?
 			 ((and (not macro-start)
 			       (c-beginning-of-macro))
+			  (save-excursion
+			    (c-backward-syntactic-ws)
+			    (setq before-sws-pos (point)))
 			  ;; Have we crossed a statement boundary?  If not,
 			  ;; keep going back until we find one or a "real" sexp.
 			  (and


-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 6 years and 13 days ago.

Previous Next


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