[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33416: GUI (X) Emacs 26.1 locks up when '(' character is entered int

From: Alan Mackenzie
Subject: 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
User-agent: tin/2.4.2-20171224 ("Lochhead") (UNIX) (FreeBSD/11.2-RELEASE-p4 (amd64))

Hello, James.

In article <address@hidden> 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)))

, 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).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]