From: Alan Mackenzie Date: Fri, 6 Aug 2010 19:48:59 +0000 (+0000) Subject: cc-cmds.el (c-mask-paragraph, c-fill-paragraph): Fix for the case that a X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~49^2~33 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bd4c5e3e069015b7ed7438155b6541cf26c44542;p=emacs.git cc-cmds.el (c-mask-paragraph, c-fill-paragraph): Fix for the case that a C style comment has its delimiters alone on their respective lines. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b5d7984c04f..2cfe12d0019 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-08-06 Alan Mackenzie + + * progmodes/cc-cmds.el (c-mask-paragraph, c-fill-paragraph): Fix + for the case that a C style comment has its delimiters alone on + their respective lines. + 2010-08-06 Michael Albinus * net/tramp.el (tramp-handle-start-file-process ): Set connection diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 6d4479cb204..02fc3950a34 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -4001,6 +4001,14 @@ command to conveniently insert and align the necessary backslashes." (goto-char ender-start) (current-column))) (point-rel (- ender-start here)) + (sentence-ends-comment + (save-excursion + (goto-char ender-start) + (and (search-backward-regexp + (c-sentence-end) (c-point 'bol) t) + (goto-char (match-end 0)) + (looking-at "[ \t]*") + (= (match-end 0) ender-start)))) spaces) (save-excursion @@ -4043,7 +4051,9 @@ command to conveniently insert and align the necessary backslashes." (setq spaces (max (min spaces - (if sentence-end-double-space 2 1)) + (if (and sentence-ends-comment + sentence-end-double-space) + 2 1)) 1))) ;; Insert the filler first to keep marks right. (insert-char ?x spaces t) @@ -4253,8 +4263,11 @@ Optional prefix ARG means justify paragraph as well." (let ((fill-paragraph-function ;; Avoid infinite recursion. (if (not (eq fill-paragraph-function 'c-fill-paragraph)) - fill-paragraph-function))) - (c-mask-paragraph t nil 'fill-paragraph arg)) + fill-paragraph-function)) + (start-point (point-marker))) + (c-mask-paragraph + t nil (lambda () (fill-region-as-paragraph (point-min) (point-max) arg))) + (goto-char start-point)) ;; Always return t. This has the effect that if filling isn't done ;; above, it isn't done at all, and it's therefore effectively ;; disabled in normal code.