From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: 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 Message-ID: <20190505090622.GA4193@ACM> References: <20171024203312.GA5875@ACM> <20171025191137.GA16060@ACM> <83wp3h7tar.fsf@gnu.org> <87o94oz210.fsf@tcd.ie> <20190430113302.GB4142@ACM> <8736lzirbn.fsf@tcd.ie> <83h8afsee5.fsf@gnu.org> <83y33qovrw.fsf@gnu.org> <20190504124102.GB4139@ACM> <83pnoyl4t7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="117221"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: contovob@tcd.ie, 28850@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 05 11:07:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hND78-000ULH-DX for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 May 2019 11:07:18 +0200 Original-Received: from localhost ([127.0.0.1]:38306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hND75-0005Ej-VE for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 May 2019 05:07:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hND6t-0005Dc-Hp for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 05:07:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hND6s-0007iZ-Hl for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 05:07:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39419) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hND6s-0007iN-DT for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 05:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hND6s-0001tE-86 for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 05:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 May 2019 09:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28850 X-GNU-PR-Package: emacs Original-Received: via spool by 28850-submit@debbugs.gnu.org id=B28850.15570471887217 (code B ref 28850); Sun, 05 May 2019 09:07:02 +0000 Original-Received: (at 28850) by debbugs.gnu.org; 5 May 2019 09:06:28 +0000 Original-Received: from localhost ([127.0.0.1]:52963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hND6J-0001sL-Nb for submit@debbugs.gnu.org; Sun, 05 May 2019 05:06:28 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:47491 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hND6H-0001s9-HI for 28850@debbugs.gnu.org; Sun, 05 May 2019 05:06:26 -0400 Original-Received: (qmail 25029 invoked by uid 3782); 5 May 2019 09:06:23 -0000 Original-Received: from acm.muc.de (p2E5D575B.dip0.t-ipconnect.de [46.93.87.91]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 05 May 2019 11:06:22 +0200 Original-Received: (qmail 4520 invoked by uid 1000); 5 May 2019 09:06:22 -0000 Content-Disposition: inline In-Reply-To: <83pnoyl4t7.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158782 Archived-At: 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@tcd.ie, 28850@debbugs.gnu.org > > From: Alan Mackenzie > > > > 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).