GNU bug report logs - #11841
24.1; emacs hangs when opening cpp file with mixed eol styles

Previous Next

Packages: cc-mode, emacs;

Reported by: Vadim K <vadimsks <at> gmail.com>

Date: Mon, 2 Jul 2012 04:34:02 UTC

Severity: important

Merged with 11891, 13046

Found in versions 23.4, 24.1

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

Bug is archived. No further changes may be made.

Full log


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

From: Alan Mackenzie <acm <at> muc.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 11841 <at> debbugs.gnu.org, vadimsks <at> gmail.com
Subject: Re: bug#11841: 24.1; emacs hangs when opening cpp file with mixed
	eol styles
Date: Sun, 8 Jul 2012 15:34:13 +0000
Hello, Stefan.

On Sun, Jul 08, 2012 at 10:50:03AM -0400, Stefan Monnier wrote:
> >> > Just as an observation, (forward-comment -1) doesn't move back over a ^M.

> >> Why should it?  It's not a whitespace, and while it has "comment end"
> >> syntax, it does not have a matching comment-start.

> >> I think you should give it whitespace syntax.
> >> Currently "foo // bar ^M baz ^J" is treated in CC-mode as "foo <comment>
> >> baz", which I think is wrong.

I've tried setting ^M's syntax to WS.  The code no longer loops.
However, ^M is syntactically a comment ender so that it can end a comment
when selective-display is active.

> > Perhaps so, but in the file in question you have ^M^J with northing
> > between them.  So a lone ^M is not an issue here.

> Yes it is: without a "//" in front of it, a ^M is not a comment-ender
> and syntax.c then treats it as a "strange char" (for \n used as comment
> ender, syntax.c knows to treat it as whitespace when there's no
> matching comment-starter, but that's a special case, for other chars
> this is not so, e.g. for pascal's } it would be wrong to treat it as
> whitespace).

Would it not be better for ^M to be treated as WS by syntax.c?  The
current problem isn't really a CC Mode one; mixed line enders could
happen in a file of any major mode.  Emacs really ought to treat all line
endings the same.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 12 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.