unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Cc: Emacs Developement List <emacs-devel@gnu.org>, bug-cc-mode@gnu.org
Subject: Re: HEAD cc-mode bug: /* */ {}
Date: Fri, 6 Feb 2004 09:55:09 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.3.96.1040204155421.279A-100000@acm.acm> (raw)
In-Reply-To: <quack.20040131T0000.j5znc4zgww@hkn.eecs.berkeley.edu>



On Sat, 31 Jan 2004, Karl Chen wrote:

>Dear Emacs, cc-mode developers:

>I believe this is a bug in cc-mode's c-electric-brace: if you type
>a brace ('{' or '}') without a preceding newline, any preceding
>comments are deleted.

Indeed, so.

>Steps to reproduce:

>C-x C-f /tmp/a.c (or .cc, .java, etc)

>foo
>// line comment
>/* block comment */   {


>Typing the '{' (or '}') deletes the comments such that the buffer
>now looks like:

>foo {


>This occurs with cc-mode 5.30.8 from Emacs CVS HEAD but not in
>Emacs 21.3.

Emacs 21.3 contains CC Mode 5.28.

>I suppose the fix would be to change the call to
>`c-backward-syntactic-ws'.

Absolutely!  Here's a patch which does exactly that.   Thanks for
investigating and reporting this bug.

Index: cc-cmds.el
===================================================================
RCS file: /cvsroot/cc-mode/cc-mode/cc-cmds.el,v
retrieving revision 5.268.2.4
diff -c -r5.268.2.4 cc-cmds.el
*** cc-cmds.el	1 Nov 2003 00:51:56 -0000	5.268.2.4
--- cc-cmds.el	6 Feb 2004 09:44:35 -0000
***************
*** 479,485 ****
  	  ;; end up before it.
  	  (setq delete-temp-newline
  		(cons (save-excursion
! 			(c-backward-syntactic-ws)
  			(copy-marker (point) t))
  		      (point-marker))))
  	(unwind-protect
--- 479,486 ----
  	  ;; end up before it.
  	  (setq delete-temp-newline
  		(cons (save-excursion
! 			(end-of-line 0)
! 			(skip-chars-backward " \t")
  			(copy-marker (point) t))
  		      (point-marker))))
  	(unwind-protect

>Karl 2004-01-30 23:46

-- 
Alan Mackenzie (Munich, Germany)




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn


      reply	other threads:[~2004-02-06  9:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-31  8:00 HEAD cc-mode bug: /* */ {} Karl Chen
2004-02-06  9:55 ` Alan Mackenzie [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.3.96.1040204155421.279A-100000@acm.acm \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).