]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix filling for when filladapt mode is enabled.
authorAlan Mackenzie <acm@muc.de>
Fri, 13 Jan 2012 10:59:27 +0000 (10:59 +0000)
committerAlan Mackenzie <acm@muc.de>
Fri, 13 Jan 2012 10:59:27 +0000 (10:59 +0000)
lisp/progmodes/cc-cmds.el
lisp/progmodes/cc-mode.el

index 76b9f3041649ea771033636ac88bab791dfa2890..509bb203f78d6bfbe7f6b02ac9b8f4dca338856b 100644 (file)
@@ -4382,11 +4382,8 @@ 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))
-       (start-point (point-marker)))
-    (c-mask-paragraph
-     t nil (lambda () (fill-region-as-paragraph (point-min) (point-max) arg)))
-    (goto-char start-point))
+            fill-paragraph-function)))
+    (c-mask-paragraph t nil 'fill-paragraph arg))
   ;; 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.
index b74d878516dcaa73f24b24fe35ff37c8134fc7c4..0c86b68f1d949d0e25d54a2b5b94cc2cbd38e5ce 100644 (file)
@@ -490,6 +490,7 @@ that requires a literal mode spec at compile time."
   (make-local-variable 'paragraph-ignore-fill-prefix)
   (make-local-variable 'adaptive-fill-mode)
   (make-local-variable 'adaptive-fill-regexp)
+  (make-local-variable 'fill-paragraph-handle-comment)
 
   ;; now set their values
   (set (make-local-variable 'parse-sexp-ignore-comments) t)
@@ -500,6 +501,9 @@ that requires a literal mode spec at compile time."
   (set (make-local-variable 'comment-line-break-function)
        'c-indent-new-comment-line)
 
+  ;; For the benefit of adaptive file, which otherwise mis-fills.
+  (setq fill-paragraph-handle-comment nil)
+
   ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a
   ;; direct call to `fill-paragraph' behaves better.  This still
   ;; doesn't work with filladapt but it's better than nothing.