unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: michael@cadilhac.name (Michaël Cadilhac)
Cc: bug-cc-mode@gnu.org, Toby Allsopp <Toby.Allsopp@navman.com>,
	monnier@IRO.UMontreal.CA, emacs-devel@gnu.org
Subject: Re: [Toby.Allsopp@navman.com: auto-fill in c-mode messes up incomplete comments]
Date: Mon, 25 Dec 2006 12:25:46 +0100	[thread overview]
Message-ID: <87d568b4jp.fsf@lrde.org> (raw)
In-Reply-To: <E1Gydvi-0002NK-M0@fencepost.gnu.org> (Richard Stallman's message of "Sun\, 24 Dec 2006 19\:43\:02 -0500")


[-- Attachment #1.1.1: Type: text/plain, Size: 611 bytes --]

Richard Stallman <rms@gnu.org> writes:

> From: Toby Allsopp <Toby.Allsopp@navman.com>
> Subject: auto-fill in c-mode messes up incomplete comments
> To: emacs-pretest-bug@gnu.org
> Cc: emacs-snapshot@packages.debian.org
> Date: Tue, 28 Nov 2006 11:48:39 +1300
>
>>From a shell prompt:
>
> emacs -q /tmp/tmp.c
> M-x auto-fill-mode
> /*
> * 
>
> (That's / * <return> * SPC).
>
> When typing the final space, the second line gets deleted.  Pressing
> return instead messes it up differently.  This seems to be a problem
> with c-mask-paragraph.

Toby, does the following fix your problem?


[-- Attachment #1.1.2: cc-cmds.patch --]
[-- Type: text/x-patch, Size: 1851 bytes --]

Index: lisp/progmodes/cc-cmds.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/cc-cmds.el,v
retrieving revision 1.46
diff -c -r1.46 cc-cmds.el
*** lisp/progmodes/cc-cmds.el	3 Dec 2006 00:56:56 -0000	1.46
--- lisp/progmodes/cc-cmds.el	25 Dec 2006 11:23:00 -0000
***************
*** 3707,3715 ****
  
  		  (save-excursion
  		    (goto-char (cdr c-lit-limits))
- 		    (setq tmp-post (point-marker))
- 		    (insert ?\n)
- 		    (set-marker end (point))
  		    (forward-line -1)	; last line of the comment
  		    (if (and (looking-at (concat "[ \t]*\\(\\("
  						 c-current-comment-prefix
--- 3707,3712 ----
***************
*** 3750,3756 ****
  			  (setq point-rel
  				(and (>= point-rel 0)
  				     (- (point) (min point-rel spaces)))))
! 		      (setq point-rel nil)))
  
  		  (if point-rel
  		      ;; Point was in the middle of the string we
--- 3747,3757 ----
  			  (setq point-rel
  				(and (>= point-rel 0)
  				     (- (point) (min point-rel spaces)))))
! 		      (setq point-rel nil))
! 		    (goto-char (cdr c-lit-limits))
! 		    (setq tmp-post (point-marker))
! 		    (insert ?\n)
! 		    (set-marker end (point)))
  
  		  (if point-rel
  		      ;; Point was in the middle of the string we
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.10483
diff -C0 -r1.10483 ChangeLog
*** lisp/ChangeLog	25 Dec 2006 00:22:49 -0000	1.10483
--- lisp/ChangeLog	25 Dec 2006 11:24:23 -0000
***************
*** 0 ****
--- 1,5 ----
+ 2006-12-25  Michaël Cadilhac  <michael.cadilhac@lrde.org>
+ 
+ 	* progmodes/cc-cmds.el (c-mask-paragraph): Append the `\n' only after
+ 	the `hang-ender-stuck' treatment.
+ 

[-- Attachment #1.1.3: Type: text/plain, Size: 412 bytes --]


Thanks.
-- 
/!\ My mail address has changed, please update your files accordingly.
 |      Michaël `Micha' Cadilhac     |  Pour les 35-40 ans, l'humour          |
 |         Epita/LRDE Promo 2007     |       c'est une plus-value.            |
 |  http://michael.cadilhac.name     |          -- Guillaume L.               |
 `--JID: michael.cadilhac@gmail.com--'                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

  reply	other threads:[~2006-12-25 11:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-25  0:43 [Toby.Allsopp@navman.com: auto-fill in c-mode messes up incomplete comments] Richard Stallman
2006-12-25 11:25 ` Michaël Cadilhac [this message]
2006-12-26  0:13   ` Toby Allsopp
2006-12-26  2:26   ` Richard Stallman
2006-12-26 10:47     ` Michaël Cadilhac
2006-12-27  2:59       ` Richard Stallman
2007-01-01 22:49         ` Alan Mackenzie
2006-12-28 22:09       ` Giorgos Keramidas
2007-01-02 21:09 ` Alan Mackenzie
2007-01-03 20:46   ` Alan Mackenzie
2007-01-04  7:59     ` Toby Allsopp

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=87d568b4jp.fsf@lrde.org \
    --to=michael@cadilhac.name \
    --cc=Toby.Allsopp@navman.com \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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).