GNU bug report logs - #13046
23.4; Minimal Example to freeze emacs C++ mode (nasty interaction between templates & windows endline characters )

Previous Next

Packages: cc-mode, emacs;

Reported by: John Smith <drefleladi <at> gmail.com>

Date: Sat, 1 Dec 2012 18:37:02 UTC

Severity: important

Merged with 11841, 11891

Found in versions 23.4, 24.1

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 13046 in the body.
You can then email your comments to 13046 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#13046; Package emacs. (Sat, 01 Dec 2012 18:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Smith <drefleladi <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 01 Dec 2012 18:37:02 GMT) Full text and rfc822 format available.

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

From: John Smith <drefleladi <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.4; Minimal Example to freeze emacs C++ mode (nasty interaction
	between templates & windows endline characters )
Date: Sat, 1 Dec 2012 16:22:20 +0100
[Message part 1 (text/plain, inline)]
Dear Maintainers,

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

Cheers,
[Message part 2 (text/html, inline)]
[crash.hpp (text/x-c++hdr, attachment)]

Severity set to 'important' from 'normal' Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 02 Dec 2012 02:06:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Sun, 02 Dec 2012 02:17:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Alan Mackenzie  <acm <at> muc.de>
Cc: John Smith <drefleladi <at> gmail.com>, 13046 <at> debbugs.gnu.org
Subject: Re: bug#13046: 23.4;
	Minimal Example to freeze emacs C++ mode (nasty interaction between
	templates & windows endline characters )
Date: Sun, 02 Dec 2012 10:13:47 +0800
John Smith <drefleladi <at> 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.




Merged 11841 11891 13046. Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 02 Dec 2012 02:17:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Sun, 02 Dec 2012 15:56:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Chong Yidong <cyd <at> gnu.org>
Cc: John Smith <drefleladi <at> gmail.com>, 13046 <at> debbugs.gnu.org
Subject: Re: bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty
	interaction between templates & windows endline characters )
Date: Sun, 2 Dec 2012 15:46:35 +0000
Hello, Yidong.

On Sun, Dec 02, 2012 at 10:13:47AM +0800, Chong Yidong wrote:
> John Smith <drefleladi <at> 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).

Yes.

> I think this is a duplicate of Bug#11841.

I think so too, though 11841 has at least two distinct bugs causing the
same symptom.

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

The problem in John Smith's case is that c-backward-sws ("backward
syntactic whitespace") doesn't always go back over a ^M, causing the
calling routine to loop.  I'm looking into this at the moment.

> Alan, could you take another look?  It would be good to have this fixed
> in Emacs 24.3.

Agreed.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Sun, 02 Dec 2012 18:26:03 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Chong Yidong <cyd <at> gnu.org>
Cc: Vadim K <vadimsks <at> gmail.com>, John Smith <drefleladi <at> gmail.com>,
	13046 <at> debbugs.gnu.org
Subject: Re: 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
Hello Yidong, Vadim, John.

On Sun, Dec 02, 2012 at 10:13:47AM +0800, Chong Yidong wrote:
> John Smith <drefleladi <at> 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).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Mon, 03 Dec 2012 08:58:04 GMT) Full text and rfc822 format available.

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

From: John Smith <drefleladi <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Chong Yidong <cyd <at> gnu.org>, 13046 <at> debbugs.gnu.org,
	Vadim K <vadimsks <at> gmail.com>
Subject: Re: bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty
	interaction between templates & windows endline characters )
Date: Mon, 3 Dec 2012 09:54:51 +0100
[Message part 1 (text/plain, inline)]
Hello all,

I'm afraid my limited emacs knowledge will not allow me to test the patch.
(Building fresh from source + patching the lisp => too much :) )
I trust however that it does!

Thanks for being so responsive.

Yours Sincerely,
John

On Sun, Dec 2, 2012 at 7:16 PM, Alan Mackenzie <acm <at> muc.de> wrote:

> Hello Yidong, Vadim, John.
>
> On Sun, Dec 02, 2012 at 10:13:47AM +0800, Chong Yidong wrote:
> > John Smith <drefleladi <at> 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).
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Wed, 05 Dec 2012 20:18:01 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: John Smith <drefleladi <at> gmail.com>
Cc: Chong Yidong <cyd <at> gnu.org>, 13046 <at> debbugs.gnu.org,
	Vadim K <vadimsks <at> gmail.com>
Subject: Re: bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty
	interaction between templates & windows endline characters )
Date: Wed, 5 Dec 2012 20:10:47 +0000
Hello, John.

On Mon, Dec 03, 2012 at 09:54:51AM +0100, John Smith wrote:
> Hello all,

> I'm afraid my limited emacs knowledge will not allow me to test the patch.
> (Building fresh from source + patching the lisp => too much :) )
> I trust however that it does!

If you want to test the patch, here's how to go about it:
(i) Make sure you've got the program `patch' installed - it's in package
"diffutils".  (I don't know the package manager in Ubuntu).

(ii) Extract my email containing the patch to a file, say foo.diff.  You
don't need to bother separating out the actual patch from all the other
stuff.

(iii) Locate cc-engine.el.  It will be somewhere like
/usr/local/share/emacs/24.2/lisp/progmodes/cc-engine.el.gz if you
installed Emacs from source, or
/usr/share/emacs/24.2/lisp/progmodes/cc-engine.el.gz if you installed
Emacs from a package manager.  In either case you can find it for sure with
C-h f c-mode <ret>, and click/type CR on the file name.  Then do C-x C-v
to see where it is.

(iv) Unzip the source file: cd <above directory>; gunzip cc-engine.el.gz

(v) Patch that file: patch < /path/to/foo.diff

(vi) Byte compile the file: (in emacs)
M-x byte-compile-file <ret> /path/to/cc-engine.el

(vii) Load the file (or restart Emacs):
M-x load-file /path/to/cc-engine.elc
(note the 'c' at the end of ".elc")

(viii) Advisable: gunzip, byte compile, and load cc-cmds.el.gz too.
This is because it uses the "defsubst" (inline function) changed in
cc-engine.el.

> Thanks for being so responsive.

Thank you for such a high quality bug report.

> Yours Sincerely,
> John

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Fri, 07 Dec 2012 04:35:02 GMT) Full text and rfc822 format available.

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

From: John Smith <drefleladi <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Chong Yidong <cyd <at> gnu.org>, 13046 <at> debbugs.gnu.org,
	Vadim K <vadimsks <at> gmail.com>
Subject: Re: bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty
	interaction between templates & windows endline characters )
Date: Fri, 7 Dec 2012 05:34:32 +0100
[Message part 1 (text/plain, inline)]
Damn you.
I *told* you that I didn't have the time & skills to look into this further
and you being so-nice-and-all guilt forced me into doing it :)

ok, so a few take-aways from giving advices to an emacs noob:

-on ubuntu the distribution only packages compiled lisp files so one needs
to add a special package to get the sources

-*In either case you can find it for sure with C-h f c-mode <ret>, and
click/type CR on the file name.  Then do C-x C-v to see where it is.*
I could switch to the C-mode but never understood what "*click/type CR on
the file name"* was supposed to mean. Anyways I found the file.

-the patch didn't work since the lines you removed changed a bit between
23.4 and HEAD, but I worked around it.

-like all good things there are dependencies: cc-defs.el for one and
friends, I had to fetch them

-mmh, it doesn't byte compile. actually, even vanilla unpatched file
doesn't byte-compile:
In c-declare-lang-variables:
cc-engine.el:162:28:Warning: reference to free variable
    `c-lang-variable-inits'
cc-engine.el:163:1:Error: Symbol's value as variable is void:
c-lang-variable-inits

I tried commenting out that line but no such luck.
I guess this is a trivial problem and I need to build something else but
mmh what? I'm stuck.
Years of devs in heaps of languages and yet I'm so helpless with this one.

Cheers and thanks for the trip.
John



On Wed, Dec 5, 2012 at 9:10 PM, Alan Mackenzie <acm <at> muc.de> wrote:

> Hello, John.
>
> On Mon, Dec 03, 2012 at 09:54:51AM +0100, John Smith wrote:
> > Hello all,
>
> > I'm afraid my limited emacs knowledge will not allow me to test the
> patch.
> > (Building fresh from source + patching the lisp => too much :) )
> > I trust however that it does!
>
> If you want to test the patch, here's how to go about it:
> (i) Make sure you've got the program `patch' installed - it's in package
> "diffutils".  (I don't know the package manager in Ubuntu).
>
> (ii) Extract my email containing the patch to a file, say foo.diff.  You
> don't need to bother separating out the actual patch from all the other
> stuff.
>
> (iii) Locate cc-engine.el.  It will be somewhere like
> /usr/local/share/emacs/24.2/lisp/progmodes/cc-engine.el.gz if you
> installed Emacs from source, or
> /usr/share/emacs/24.2/lisp/progmodes/cc-engine.el.gz if you installed
> Emacs from a package manager.  In either case you can find it for sure with
> C-h f c-mode <ret>, and click/type CR on the file name.  Then do C-x C-v
> to see where it is.
>
> (iv) Unzip the source file: cd <above directory>; gunzip cc-engine.el.gz
>
> (v) Patch that file: patch < /path/to/foo.diff
>
> (vi) Byte compile the file: (in emacs)
> M-x byte-compile-file <ret> /path/to/cc-engine.el
>
> (vii) Load the file (or restart Emacs):
> M-x load-file /path/to/cc-engine.elc
> (note the 'c' at the end of ".elc")
>
> (viii) Advisable: gunzip, byte compile, and load cc-cmds.el.gz too.
> This is because it uses the "defsubst" (inline function) changed in
> cc-engine.el.
>
> > Thanks for being so responsive.
>
> Thank you for such a high quality bug report.
>
> > Yours Sincerely,
> > John
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Sun, 09 Dec 2012 04:08:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: John Smith <drefleladi <at> gmail.com>, 13046 <at> debbugs.gnu.org,
	Vadim K <vadimsks <at> gmail.com>
Subject: Re: bug#13046: 23.4;
	Minimal Example to freeze emacs C++ mode (nasty interaction between
	templates & windows endline characters )
Date: Sun, 09 Dec 2012 12:06:56 +0800
Alan Mackenzie <acm <at> muc.de> writes:

> I think the enclosed patch fixes these bugs.  Please try out the patch
> and let us know if there are still any problems here.

Seems to work OK.  Looks like a bit of a hack, but if it fixes the bug,
so be it.  Feel free to commit to emacs-24 if you're happy with it, and
thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Sun, 09 Dec 2012 13:41:04 GMT) Full text and rfc822 format available.

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

From: Vadim K <vadimsks <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Chong Yidong <cyd <at> gnu.org>, John Smith <drefleladi <at> gmail.com>,
	13046 <at> debbugs.gnu.org
Subject: Re: bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty
	interaction between templates & windows endline characters )
Date: Sun, 9 Dec 2012 15:40:10 +0200
[Message part 1 (text/plain, inline)]
Hi Alan,


I've verified that this patch does fix the issue #11841. On my Windows XP,
after applying this patch, emacs was able to open both files that caused
the issue.


Vadim

On Sun, Dec 2, 2012 at 8:16 PM, Alan Mackenzie <acm <at> muc.de> wrote:

>
> I think the enclosed patch fixes these bugs.  Please try out the patch
> and let us know if there are still any problems here.
>
>  --
> Alan Mackenzie (Nuremberg, Germany).
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Sun, 09 Dec 2012 17:06:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: John Smith <drefleladi <at> gmail.com>
Cc: 13046 <at> debbugs.gnu.org
Subject: Re: bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty
	interaction between templates & windows endline characters )
Date: Sun, 9 Dec 2012 16:58:47 +0000
On Fri, Dec 07, 2012 at 05:34:32AM +0100, John Smith wrote:
> Damn you.
> I *told* you that I didn't have the time & skills to look into this further
> and you being so-nice-and-all guilt forced me into doing it :)

> ok, so a few take-aways from giving advices to an emacs noob:

> -on ubuntu the distribution only packages compiled lisp files so one needs
> to add a special package to get the sources

> -*In either case you can find it for sure with C-h f c-mode <ret>, and
> click/type CR on the file name.  Then do C-x C-v to see where it is.*
> I could switch to the C-mode but never understood what "*click/type CR on
> the file name"* was supposed to mean. Anyways I found the file.

> -the patch didn't work since the lines you removed changed a bit between
> 23.4 and HEAD, but I worked around it.

> -like all good things there are dependencies: cc-defs.el for one and
> friends, I had to fetch them

Sorry, I'd forgotten about the dependencies.

> -mmh, it doesn't byte compile. actually, even vanilla unpatched file
> doesn't byte-compile:
> In c-declare-lang-variables:
> cc-engine.el:162:28:Warning: reference to free variable
>     `c-lang-variable-inits'
> cc-engine.el:163:1:Error: Symbol's value as variable is void:
> c-lang-variable-inits

> I tried commenting out that line but no such luck.
> I guess this is a trivial problem and I need to build something else but
> mmh what? I'm stuck.
> Years of devs in heaps of languages and yet I'm so helpless with this one.

c-lang-variable-inits is needed at compile time, and is in a different
file.  It would probably be easiest at this stage just to compile the
entire CC Mode.  To do this, get all the files cc-*.el (there are 17)
gunzipped, and give this at the command line (not within Emacs):

$ emacs -Q -batch -f batch-byte-compile cc-*.el

> Cheers and thanks for the trip.

:-)

> John

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#13046; Package emacs,cc-mode. (Sat, 15 Dec 2012 18:03:01 GMT) Full text and rfc822 format available.

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

From: John Smith <drefleladi <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 13046 <at> debbugs.gnu.org
Subject: Re: bug#13046: 23.4; Minimal Example to freeze emacs C++ mode (nasty
	interaction between templates & windows endline characters )
Date: Sat, 15 Dec 2012 19:01:51 +0100
[Message part 1 (text/plain, inline)]
Hello,

I confirm that the patch indeed works for my work-file (which is a tad more
complicated than my contrived example)

Thanks,
Fred

On Sun, Dec 9, 2012 at 5:58 PM, Alan Mackenzie <acm <at> muc.de> wrote:

> On Fri, Dec 07, 2012 at 05:34:32AM +0100, John Smith wrote:
> > Damn you.
> > I *told* you that I didn't have the time & skills to look into this
> further
> > and you being so-nice-and-all guilt forced me into doing it :)
>
> > ok, so a few take-aways from giving advices to an emacs noob:
>
> > -on ubuntu the distribution only packages compiled lisp files so one
> needs
> > to add a special package to get the sources
>
> > -*In either case you can find it for sure with C-h f c-mode <ret>, and
> > click/type CR on the file name.  Then do C-x C-v to see where it is.*
> > I could switch to the C-mode but never understood what "*click/type CR on
> > the file name"* was supposed to mean. Anyways I found the file.
>
> > -the patch didn't work since the lines you removed changed a bit between
> > 23.4 and HEAD, but I worked around it.
>
> > -like all good things there are dependencies: cc-defs.el for one and
> > friends, I had to fetch them
>
> Sorry, I'd forgotten about the dependencies.
>
> > -mmh, it doesn't byte compile. actually, even vanilla unpatched file
> > doesn't byte-compile:
> > In c-declare-lang-variables:
> > cc-engine.el:162:28:Warning: reference to free variable
> >     `c-lang-variable-inits'
> > cc-engine.el:163:1:Error: Symbol's value as variable is void:
> > c-lang-variable-inits
>
> > I tried commenting out that line but no such luck.
> > I guess this is a trivial problem and I need to build something else but
> > mmh what? I'm stuck.
> > Years of devs in heaps of languages and yet I'm so helpless with this
> one.
>
> c-lang-variable-inits is needed at compile time, and is in a different
> file.  It would probably be easiest at this stage just to compile the
> entire CC Mode.  To do this, get all the files cc-*.el (there are 17)
> gunzipped, and give this at the command line (not within Emacs):
>
> $ emacs -Q -batch -f batch-byte-compile cc-*.el
>
> > Cheers and thanks for the trip.
>
> :-)
>
> > John
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 13 Jan 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 223 days ago.

Previous Next


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