NOTE: This patch has been committed. The version below is informational only.
In particular, whitespace difference have been removed.
The following patch makes auto-fill-mode properly format comments
(when lines are automatically broken). It looks strangely similar to
that of:
| 1999-06-24 Bob Weiner <weiner(a)beopen.com>
|
| * simple.el (indent-new-comment-line): Locally bound
| `block-comment-start' to `comstart' or else when this is called
| from do-auto-fill, e.g. in Lisp mode, it will insert any non-nil
| `block-comment-start' value, ignoring any existing spacing after a
| comment prefix in the previous line and producing ugly comments.
lisp/ChangeLog addition:
2008-03-05 Didier Verna <didier(a)xemacs.org>
Fix auto-formatting of comments in auto-fill-mode.
* newcomment.el (comment-indent): Don't insert a space at bol.
* newcomment.el (comment-indent-new-line): Bind
block-comment-start to comment-start in order to preserve the
formatting of previous comment lines.
XEmacs 21.5 source patch:
Diff command: hg diff -wbB
Files affected: lisp/newcomment.el
diff -r 7f3d065a56a1 lisp/newcomment.el
--- lisp/newcomment.el Wed Mar 05 10:41:54 2008 +0100
+++ lisp/newcomment.el Wed Mar 05 17:56:04 2008 +0100
@@ -498,7 +498,8 @@ Comments starting in column 0 are not mo
(setq begpos (point))
;; Ensure there's a space before the comment for things
;; like sh where it matters (as well as being neater).
- (unless (eq ?\ (char-syntax (char-before)))
+ ;; ... but unless we're at the beginning of a line -- dvl
+ (unless (or (bolp) (eq ?\ (char-syntax (char-before))))
(insert ?\ ))
(insert starter)
(setq cpos (point-marker))
@@ -1097,6 +1098,7 @@ unless optional argument SOFT is non-nil
(point))
nil t)))))
(comment-start comstart)
+ (block-comment-start comment-start)
(continuep (or comment-multi-line
(cadr (assoc comment-style comment-styles))))
;; Force comment-continue to be recreated from comment-start.
--
5th European Lisp Workshop at ECOOP 2008, July 7:
http://elw.bknr.net/2008/
Didier Verna, didier(a)lrde.epita.fr,
http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (0)1 44 08 01 85
94276 Le Kremlin-Bicêtre, France Fax.+33 (0)1 53 14 59 22 didier(a)xemacs.org
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches