From: Alan Mackenzie <acm@muc.de>
To: Zachary Napier <zachary.napier.44@gmail.com>
Cc: 37137@debbugs.gnu.org
Subject: bug#37137: Setting font-lock-case-fold-search to t causes hangs on certain types in c-mode
Date: 25 Aug 2019 10:22:26 -0000 [thread overview]
Message-ID: <20190825102226.52674.qmail__8184.66323414526$1566731831$gmane$org@mail.muc.de> (raw)
In-Reply-To: <mailman.18.1566429065.1922.bug-gnu-emacs@gnu.org>
Hello, Zachary.
In article <mailman.18.1566429065.1922.bug-gnu-emacs@gnu.org> you wrote:
> [-- text/plain, encoding 7bit, charset: UTF-8, 31 lines --]
> I have in my .emacs file only these two lines:
> (custom-set-variables
> '(font-lock-keywords-case-fold-search t))
May I ask why you're making this setting?
I think font-lock-keywords-case-fold-search is really intended to be set
by major modes, rather than as a user customisation.
> Then if I visit an empty or nonexistent C file and just type "LONG"
> (in all caps or with at least one letter being capital), Emacs will
> hang after typing the final G but before the G appears on
> screen. Typing C-g a couple of times gets Emacs unstuck until I
> continue to type. The same behavior also happens if I type "SHORT".
Yes. The keywords in all the CC Mode languages are case sensitive.
Almost exactly the same bug came up in 2013, when the solution was to
bind case-fold-search to nil at every "entry point" to CC Mode. I missed
font-lock-keywords-case-fold-search at the time.
> This happens in both Emacs 26.1 in text mode on a Linux machine and in
> Emacs 25.3 in GUI mode on Windows.
> After messing with GDB a bit, I am pretty sure the hang is at the
> while loop in c-forward-type at cc-engine.el:7657 and its getting
> stuck because looking-at matches LONG because its case insensitive,
> but the c-forward-keyword-clause doesn't move forward because the
> first thing it does is try to find "LONG" in c-keywords-obarray via
> `intern-soft` and immediately returns because it doesn't find it
> there. Here is the while loop:
> (while (progn
> (setq safe-pos (point))
> (looking-at c-opt-type-component-key))
> (when (and c-record-type-identifiers
> (looking-at c-primitive-type-key))
> (c-record-type-id (cons (match-beginning 1)
> (match-end 1))))
> (c-forward-keyword-clause 1))
That's an excellent piece of debugging. :-)
I think the best fix for the bug would be for CC Mode to set
font-lock-keywords-case-fold-search explicitly to nil (buffer locally) at
C Mode (etc.) initialisation. This would undo the effect of your
custom-set-variables form in C Mode buffers. Would this be a problem?
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2019-08-25 10:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 22:20 bug#37137: Setting font-lock-case-fold-search to t causes hangs on certain types in c-mode Zachary Napier
[not found] ` <mailman.18.1566429065.1922.bug-gnu-emacs@gnu.org>
2019-08-25 10:22 ` Alan Mackenzie [this message]
2019-08-25 18:12 ` Stefan Monnier
2019-09-01 21:28 ` Zachary Napier
2019-09-02 12:50 ` Stefan Monnier
2019-09-02 19:26 ` Alan Mackenzie
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='20190825102226.52674.qmail__8184.66323414526$1566731831$gmane$org@mail.muc.de' \
--to=acm@muc.de \
--cc=37137@debbugs.gnu.org \
--cc=zachary.napier.44@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.