GNU bug report logs - #33416
GUI (X) Emacs 26.1 locks up when '(' character is entered into a comment in (C/*l Abbrev) mode

Previous Next

Packages: cc-mode, emacs;

Reported by: James Vaughan <dev.jamesvaughan <at> gmail.com>

Date: Sat, 17 Nov 2018 22:27:01 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33416 in the body.
You can then email your comments to 33416 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#33416; Package emacs. (Sat, 17 Nov 2018 22:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to James Vaughan <dev.jamesvaughan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 17 Nov 2018 22:27:01 GMT) Full text and rfc822 format available.

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

From: James Vaughan <dev.jamesvaughan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: GUI (X) Emacs 26.1 locks up when '(' character is entered into a
 comment in (C/*l Abbrev) mode
Date: Sat, 17 Nov 2018 17:04:38 -0500
[Message part 1 (text/plain, inline)]
Reproduction
These are the precise steps I took, using this code
<https://gitlab.com/jvaughan/bpm.c> @
b6e7e4a6462644d83642ef2b1fae0a937c2fb339 :
1. With working directory in 'bpm.c/', start GUI Emacs in the background
with `emacs &`
2. Enter `C-x 3` to get vertical split, click into the right window, and
enter `C-x 2`.
3. From there, `M-x shell` to get a shell (zsh) in the bottom right corner.
4. Click into top right corner, `C-x C-f inc/parser.h`
5. Click into left half, `C-x C-f src/parser.c`
6. Append `// Continue checking if line is a comment (`.
Emacs will hang, not showing `(` or responding to clicks, commands, or GUI
interaction.
I had to `kill -9` it to get rid of it completely.
ps -a shows stat of emacs as RNl

$ uname -a
Linux workstation 4.19.1-arch1-1-ARCH #1 SMP PREEMPT Sun Nov 4 16:49:26 UTC
2018 x86_64 GNU/Linux

Thank you for looking into this.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#33416; Package emacs,cc-mode. (Mon, 19 Nov 2018 12:31:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: James Vaughan <dev.jamesvaughan <at> gmail.com>
Cc: acm <at> muc.de, 33416 <at> debbugs.gnu.org
Subject: Re: bug#33416: GUI (X) Emacs 26.1 locks up when '(' character is
 entered	into a comment in (C/*l Abbrev) mode
Date: 19 Nov 2018 12:30:51 -0000
Hello, James.

In article <mailman.4183.1542493624.1284.bug-gnu-emacs <at> gnu.org> you wrote:
> [-- text/plain, encoding 7bit, charset: UTF-8, 23 lines --]

> Reproduction
> These are the precise steps I took, using this code
> <https://gitlab.com/jvaughan/bpm.c> @
> b6e7e4a6462644d83642ef2b1fae0a937c2fb339 :
> 1. With working directory in 'bpm.c/', start GUI Emacs in the background
> with `emacs &`
> 2. Enter `C-x 3` to get vertical split, click into the right window, and
> enter `C-x 2`.
> 3. From there, `M-x shell` to get a shell (zsh) in the bottom right corner.
> 4. Click into top right corner, `C-x C-f inc/parser.h`
> 5. Click into left half, `C-x C-f src/parser.c`
> 6. Append `// Continue checking if line is a comment (`.
> Emacs will hang, not showing `(` or responding to clicks, commands, or GUI
> interaction.
> I had to `kill -9` it to get rid of it completely.
> ps -a shows stat of emacs as RNl

> $ uname -a
> Linux workstation 4.19.1-arch1-1-ARCH #1 SMP PREEMPT Sun Nov 4 16:49:26 UTC
> 2018 x86_64 GNU/Linux

> Thank you for looking into this.

Thank you for taking the trouble to report this bug.

It is triggered solely by the events in the file you are typing the
comment into, and that because the comment is right at the end of the
buffer without even a newline after it.  CC Mode was getting into a loop
because it assumed that it wasn't in a comment when in fact it was.

Would you please apply the following patch to
.../emacs/lisp/progmodes/cc-mode.el in your Emacs 26.1:


diff -r 9c8496488dda cc-mode.el
--- a/cc-mode.el	Tue Oct 30 11:17:42 2018 +0000
+++ b/cc-mode.el	Mon Nov 19 12:05:28 2018 +0000
@@ -1784,7 +1784,10 @@
 	 (c-syntactic-skip-backward "^;{}" bod-lim t)
 	 (> (point) bod-lim)
 	 (progn (c-forward-syntactic-ws)
-		(setq bo-decl (point))
+		;; Have we got stuck in a comment at EOB?
+		(not (and (eobp)
+			  (c-literal-start))))
+	 (progn (setq bo-decl (point))
 		(or (not (looking-at c-protection-key))
 		    (c-forward-keyword-clause 1)))
 	 (progn

, then byte compile the file, reload it into Emacs, and then check that
the bug has indeed been fixed.  Then, please let me know!  If you want
any help with the patching or byte compiling, feel free to send me
personal email.

Thanks once more for the bug report!

-- 
Alan Mackenzie (Nuremberg, Germany).





Added tag(s) patch. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Mon, 19 Nov 2018 15:39:01 GMT) Full text and rfc822 format available.

Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Sat, 24 Nov 2018 10:43:01 GMT) Full text and rfc822 format available.

Notification sent to James Vaughan <dev.jamesvaughan <at> gmail.com>:
bug acknowledged by developer. (Sat, 24 Nov 2018 10:43:02 GMT) Full text and rfc822 format available.

Message #15 received at 33416-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: James Vaughan <dev.jamesvaughan <at> gmail.com>
Cc: 33416-done <at> debbugs.gnu.org
Subject: Re: bug#33416: GUI (X) Emacs 26.1 locks up when '(' character is
 entered into a comment in (C/*l Abbrev) mode
Date: Sat, 24 Nov 2018 10:39:15 +0000
Hello, James.

Thanks for the testing!

I've committed the patch to the emacs-26 branch, so it should hopefully
be part of the "soon" to be released Emacs 26.2.  With this post I'm
closing the bug.

-- 
Alan Mackenzie (Nuremberg, Germany).

On Mon, Nov 19, 2018 at 18:15:42 -0500, James Vaughan wrote:
> Hello Alan,

> Your patch does appear to have solved the problem, thank you!

> I also got to learn some things about Emacs in the process.
> Win-win situation to me ;)

> Thanks,

> James Vaughan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 22 Dec 2018 12:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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