From: Alan Mackenzie <acm@muc.de>
To: xh yang <linux.xhyang@gmail.com>
Cc: 33784-done@debbugs.gnu.org
Subject: bug#33784:
Date: Thu, 20 Dec 2018 12:53:26 +0000 [thread overview]
Message-ID: <20181220125326.GA4404__34300.4354429015$1545310813$gmane$org@ACM> (raw)
In-Reply-To: <CAC8d8-YT_b-xCpqDKHOrm816EODSM+sSA_2DqtATUxyiuaDQaw@mail.gmail.com>
Hello, xh.
On Thu, Dec 20, 2018 at 15:18:49 +0800, xh yang wrote:
> I found if remove first '\n' from the *str,then run emacs will not hang.*
> *May be it has nothing to do with font-lock, just str parsing ?*
Sorry for all the distraction in the last couple of days. As you
suggested in your opening post, the problem was a simple infinite loop
involving c-backward-token-2. This was in CC Mode's font-locking code.
I've committed a fix to the emacs-26 branch, and it should find its way
to the master branch within a few days. I'm closing the bug.
Here is the patch:
# HG changeset patch
# User Alan Mackenzie <acm@muc.de>
# Date 1545307557 0
# Thu Dec 20 12:05:57 2018 +0000
# Node ID 5319aa054ccb77924e19b836093c9e1b3ff91d4b
# Parent a3f28b92890acc5289cde497ea1335f4b39239d7
Check result from c-backward-token-2 to avoid infinite loop
This fixes bug #33784.
* cc-fonts.el (c-get-fontification-context): While moving back over enclosing
parentheses, check that c-backward-token-2 actually moves.
diff -r a3f28b92890a -r 5319aa054ccb cc-fonts.el
--- a/cc-fonts.el Thu Dec 20 12:04:53 2018 +0000
+++ b/cc-fonts.el Thu Dec 20 12:05:57 2018 +0000
@@ -1255,8 +1255,8 @@
(save-excursion
(goto-char match-pos)
(while
- (progn (c-backward-token-2)
- (eq (char-after) ?\()))
+ (and (zerop (c-backward-token-2))
+ (eq (char-after) ?\()))
(looking-at c-arithmetic-op-regexp)))
(cons nil nil))
;; In a C++ member initialization list.
Thanks, once more, for the bug report.
--
Alan Mackenzie (Nuremberg, Germany).
prev parent reply other threads:[~2018-12-20 12:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-18 4:09 bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang xh yang
[not found] ` <mailman.5878.1545108246.1284.bug-gnu-emacs@gnu.org>
2018-12-18 17:47 ` Alan Mackenzie
[not found] ` <20181218174716.96822.qmail@mail.muc.de>
2018-12-18 18:51 ` Eli Zaretskii
2018-12-18 18:55 ` Alan Mackenzie
[not found] ` <20181218185505.GC8949@ACM>
2018-12-18 19:23 ` Eli Zaretskii
2018-12-18 21:05 ` Alan Mackenzie
2018-12-18 22:05 ` Glenn Morris
2018-12-19 19:20 ` Alan Mackenzie
2018-12-19 15:22 ` Eli Zaretskii
2018-12-20 7:18 ` bug#33784: xh yang
2018-12-20 12:53 ` Alan Mackenzie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='20181220125326.GA4404__34300.4354429015$1545310813$gmane$org@ACM' \
--to=acm@muc.de \
--cc=33784-done@debbugs.gnu.org \
--cc=linux.xhyang@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.