GNU bug report logs - #4847
C++ Mode mistreats < and > as balanced delimiters

Previous Next

Packages: cc-mode, emacs;

Reported by: Taylor R Campbell <campbell <at> mumble.net>

Date: Sun, 1 Nov 2009 23:15:04 UTC

Severity: normal

Merged with 4984

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

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 4847 in the body.
You can then email your comments to 4847 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4847; Package emacs. (Sun, 01 Nov 2009 23:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Taylor R Campbell <campbell <at> mumble.net>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 01 Nov 2009 23:15:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Taylor R Campbell <campbell <at> mumble.net>
To: bug-gnu-emacs <at> gnu.org
Subject: C++ Mode mistreats < and > as balanced delimiters
Date: Sun, 1 Nov 2009 18:09:41 -0500
GNU Emacs 22.3.1 (i386-apple-darwin9.7.0, GTK+ Version 2.12.9) of 2009-08-10 on Oberon.local

In an empty buffer in C++ Mode, type

if (foo < bar) { }

and then change it to

if (foo < > bar) { }

and then change it back.

Now your buffer is in a bogus state, with Emacs thinking that the < is
mismatched with the ), and that there is nothing matching the (.

It is OK not to treat angle brackets as delimiters when they are, in
templates: it requires a little extra work by the user (to see, edit,
indent, &c., the balanced pairs), but doesn't break anything.

It is not OK to treat angle brackets as delimiters when they aren't,
in comparisons and shifts: it breaks the entire structure of the text
in the buffer, and thus it breaks swaths of commands that users use
all the time without thinking such as C-M-f and C-M-b.

If Emacs has the option of being clever about angle brackets in
templates, the user should have the option of disabling it because it
is incredibly frustrating when the cleverness fails.  But I couldn't
find any way to disable this broken cleverness, by aproposing for
`C++', by reading the CC Mode manual, or by skimming the (unbelievably
hairy) code.

I even tried to fool C++ Mode by changing the entries for ?< and ?> in
c++-mode-syntax-table, which didn't help because that's not where the
guilty entries are; by changing c++-template-syntax-table, which
didn't help because it is not globally defined and apparently
regenerated for each instance of C++ Mode; and by adding a hook to
c++-mode-hook which changes c++-template-syntax-table, which still
didn't work, at which point I lost interest in trying to figure out
this mess.  So it seems as though C++ Mode takes special effort to
thwart any attempts to work around its broken cleverness surrounding
angle brackets.




bug reassigned from package 'emacs' to 'emacs,cc-mode'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Wed, 04 Nov 2009 17:50:09 GMT) Full text and rfc822 format available.

Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Mon, 03 Oct 2011 19:11:01 GMT) Full text and rfc822 format available.

Notification sent to Taylor R Campbell <campbell <at> mumble.net>:
bug acknowledged by developer. (Mon, 03 Oct 2011 19:11:01 GMT) Full text and rfc822 format available.

Message #12 received at 4847-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 4847-done <at> debbugs.gnu.org
Subject: Re: bug#4847: C++ Mode mistreats < and > as balanced delimiters
Date: Mon, 03 Oct 2011 15:09:06 -0400
Version: 24.1

I see this problem in Emacs 23.3, but not in the current trunk, so it
looks like it has been fixed.




Forcibly Merged 4847 4984. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 03 Oct 2011 19:13:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Nov 2011 11:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 290 days ago.

Previous Next


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