all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: James Vaughan <dev.jamesvaughan@gmail.com>
Cc: acm@muc.de, 33416@debbugs.gnu.org
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	[thread overview]
Message-ID: <20181119123051.69905.qmail@mail.muc.de> (raw)
In-Reply-To: <mailman.4183.1542493624.1284.bug-gnu-emacs@gnu.org>

Hello, James.

In article <mailman.4183.1542493624.1284.bug-gnu-emacs@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).






  parent reply	other threads:[~2018-11-19 12:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-17 22:04 bug#33416: GUI (X) Emacs 26.1 locks up when '(' character is entered into a comment in (C/*l Abbrev) mode James Vaughan
     [not found] ` <mailman.4183.1542493624.1284.bug-gnu-emacs@gnu.org>
2018-11-19 12:30   ` Alan Mackenzie [this message]
     [not found]     ` <CAPj0kmyrn+HKW-2SKOmU_iUj5OnTuwJac4JCsa0xdo-ZJcr+fQ@mail.gmail.com>
2018-11-24 10:39       ` 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=20181119123051.69905.qmail@mail.muc.de \
    --to=acm@muc.de \
    --cc=33416@debbugs.gnu.org \
    --cc=dev.jamesvaughan@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.