From: Alan Mackenzie <acm@muc.de>
To: Chong Yidong <cyd@gnu.org>
Cc: Vadim K <vadimsks@gmail.com>,
13046@debbugs.gnu.org, John Smith <drefleladi@gmail.com>
Subject: bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty interaction between templates & windows endline characters )
Date: Sun, 2 Dec 2012 18:16:23 +0000 [thread overview]
Message-ID: <20121202181623.GB12129@acm.acm> (raw)
In-Reply-To: <87txs5fbfo.fsf@gnu.org>
Hello Yidong, Vadim, John.
On Sun, Dec 02, 2012 at 10:13:47AM +0800, Chong Yidong wrote:
> John Smith <drefleladi@gmail.com> writes:
> > Using emacs -Q,just open the attached minimal example and try typing
> > "std::string" in the body of the function.
> > That should hang emacs forever (or at least it does on my up-to-date
> > ubuntu).
> I think this is a duplicate of Bug#11841.
> The patch posted in Bug#11841 does not completely fix this test case.
> Giving ^M whitespace syntax in CC mode, as Stefan suggested, seems like
> the easiest solution. Alan, could you take another look? It would be
> good to have this fixed in Emacs 24.3.
On Wed, Jul 25, 2012 at 11:58:22PM +0300, Vadim K wrote:
> Hello Alan,
> I've tried your patch and it worked fine for the original posted
> bad.cpp file. However I have found a variation of that file that still
> causes emacs to hang (see attached bad2.cpp).
[ Bug #11841 ]
I think the enclosed patch fixes these bugs. Please try out the patch
and let us know if there are still any problems here.
The basic problem is that (forward-comment -1) doesn't recognise a CR
character as whitespace. My first attempt to patch this, in July, was
only partly successful.
The specific problem was that (forward-comment -1) _sometimes_ goes back
over the LF in CRLF, sometimes not. I've not discovered by what
criterion.
diff -r 1adcc48506f9 cc-engine.el
--- a/cc-engine.el Sun Apr 22 09:42:29 2012 +0000
+++ b/cc-engine.el Sun Dec 02 17:46:53 2012 +0000
@@ -1454,8 +1454,21 @@
;; return t when moving backwards at bob.
(not (bobp))
- (if (let (open-paren-in-column-0-is-defun-start)
- (forward-comment -1))
+ (if (let (open-paren-in-column-0-is-defun-start moved-comment)
+ (while
+ (and (not (setq moved-comment (forward-comment -1)))
+ ;; Cope specifically with ^M^J here -
+ ;; forward-comment sometimes gets stuck after ^Ms,
+ ;; sometimes after ^M^J.
+ (or
+ (when (eq (char-before) ?\r)
+ (backward-char)
+ t)
+ (when (and (eq (char-before) ?\n)
+ (eq (char-before (1- (point))) ?\r))
+ (backward-char 2)
+ t))))
+ moved-comment)
(if (looking-at "\\*/")
;; Emacs <= 20 and XEmacs move back over the
;; closer of a block comment that lacks an opener.
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2012-12-02 18:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAA0CNY4S6hOa=dzq8pu8wtibaemEUTx4rs0m4+BKyCk5ohRO2w@mail.gmail.com>
2012-12-01 15:22 ` bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty interaction between templates & windows endline characters ) John Smith
2012-12-02 2:13 ` Chong Yidong
2012-12-02 15:46 ` Alan Mackenzie
2012-12-02 18:16 ` Alan Mackenzie [this message]
2012-12-03 8:54 ` John Smith
2012-12-05 20:10 ` Alan Mackenzie
[not found] ` <20121205201047.GA3656@acm.acm>
2012-12-07 4:34 ` John Smith
2012-12-09 16:58 ` Alan Mackenzie
2012-12-15 18:01 ` John Smith
2012-12-09 4:06 ` Chong Yidong
2012-12-09 13:40 ` Vadim K
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=20121202181623.GB12129@acm.acm \
--to=acm@muc.de \
--cc=13046@debbugs.gnu.org \
--cc=cyd@gnu.org \
--cc=drefleladi@gmail.com \
--cc=vadimsks@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.