emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101007: cc-cmds.el (c-mask-paragraph


From: Alan Mackenzie
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101007: cc-cmds.el (c-mask-paragraph, c-fill-paragraph): Fix for the case that a
Date: Fri, 06 Aug 2010 19:48:59 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101007
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Fri 2010-08-06 19:48:59 +0000
message:
  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.
modified:
  lisp/ChangeLog
  lisp/progmodes/cc-cmds.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-08-06 14:34:23 +0000
+++ b/lisp/ChangeLog    2010-08-06 19:48:59 +0000
@@ -1,3 +1,9 @@
+2010-08-06  Alan Mackenzie  <address@hidden>
+
+       * 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  <address@hidden>
 
        * net/tramp.el (tramp-handle-start-file-process ): Set connection

=== modified file 'lisp/progmodes/cc-cmds.el'
--- a/lisp/progmodes/cc-cmds.el 2010-07-31 09:39:24 +0000
+++ b/lisp/progmodes/cc-cmds.el 2010-08-06 19:48:59 +0000
@@ -4001,6 +4001,14 @@
                                       (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 @@
                              (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 @@
   (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]