[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: address@hidden: auto-fill in c-mode messes up incomplete comments]
From: |
Michaël Cadilhac |
Subject: |
Re: address@hidden: auto-fill in c-mode messes up incomplete comments] |
Date: |
Mon, 25 Dec 2006 12:25:46 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (gnu/linux) |
Richard Stallman <address@hidden> writes:
> From: Toby Allsopp <address@hidden>
> Subject: auto-fill in c-mode messes up incomplete comments
> To: address@hidden
> Cc: address@hidden
> 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?
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 <address@hidden>
+
+ * progmodes/cc-cmds.el (c-mask-paragraph): Append the `\n' only after
+ the `hang-ender-stuck' treatment.
+
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: address@hidden' - --'
pgpwuEYtlsq7c.pgp
Description: PGP signature