[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33784:
From: |
Alan Mackenzie |
Subject: |
bug#33784: |
Date: |
Thu, 20 Dec 2018 12:53:26 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
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).
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, xh yang, 2018/12/17
- Message not available
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, Alan Mackenzie, 2018/12/18
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, Eli Zaretskii, 2018/12/18
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, Alan Mackenzie, 2018/12/18
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, Eli Zaretskii, 2018/12/18
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, Alan Mackenzie, 2018/12/18
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, Glenn Morris, 2018/12/18
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, Alan Mackenzie, 2018/12/19
- bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang, Eli Zaretskii, 2018/12/19
bug#33784:, xh yang, 2018/12/20
- bug#33784:,
Alan Mackenzie <=