aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2012-01-13 10:59:27 +0000
committerAlan Mackenzie2012-01-13 10:59:27 +0000
commitb493658e2c67e9ae41798edefd7cb9a264e53e99 (patch)
treedb5b0a59b476e054a68d6f69acffc6b5c6379848
parente517eda4d0d6da5d4b8f12be1608fb5e17c455ff (diff)
downloademacs-b493658e2c67e9ae41798edefd7cb9a264e53e99.tar.gz
emacs-b493658e2c67e9ae41798edefd7cb9a264e53e99.zip
Fix filling for when filladapt mode is enabled.
-rw-r--r--lisp/progmodes/cc-cmds.el7
-rw-r--r--lisp/progmodes/cc-mode.el4
2 files changed, 6 insertions, 5 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 76b9f304164..509bb203f78 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -4382,11 +4382,8 @@ Optional prefix ARG means justify paragraph as well."
4382 (let ((fill-paragraph-function 4382 (let ((fill-paragraph-function
4383 ;; Avoid infinite recursion. 4383 ;; Avoid infinite recursion.
4384 (if (not (eq fill-paragraph-function 'c-fill-paragraph)) 4384 (if (not (eq fill-paragraph-function 'c-fill-paragraph))
4385 fill-paragraph-function)) 4385 fill-paragraph-function)))
4386 (start-point (point-marker))) 4386 (c-mask-paragraph t nil 'fill-paragraph arg))
4387 (c-mask-paragraph
4388 t nil (lambda () (fill-region-as-paragraph (point-min) (point-max) arg)))
4389 (goto-char start-point))
4390 ;; Always return t. This has the effect that if filling isn't done 4387 ;; Always return t. This has the effect that if filling isn't done
4391 ;; above, it isn't done at all, and it's therefore effectively 4388 ;; above, it isn't done at all, and it's therefore effectively
4392 ;; disabled in normal code. 4389 ;; disabled in normal code.
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index b74d878516d..0c86b68f1d9 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -490,6 +490,7 @@ that requires a literal mode spec at compile time."
490 (make-local-variable 'paragraph-ignore-fill-prefix) 490 (make-local-variable 'paragraph-ignore-fill-prefix)
491 (make-local-variable 'adaptive-fill-mode) 491 (make-local-variable 'adaptive-fill-mode)
492 (make-local-variable 'adaptive-fill-regexp) 492 (make-local-variable 'adaptive-fill-regexp)
493 (make-local-variable 'fill-paragraph-handle-comment)
493 494
494 ;; now set their values 495 ;; now set their values
495 (set (make-local-variable 'parse-sexp-ignore-comments) t) 496 (set (make-local-variable 'parse-sexp-ignore-comments) t)
@@ -500,6 +501,9 @@ that requires a literal mode spec at compile time."
500 (set (make-local-variable 'comment-line-break-function) 501 (set (make-local-variable 'comment-line-break-function)
501 'c-indent-new-comment-line) 502 'c-indent-new-comment-line)
502 503
504 ;; For the benefit of adaptive file, which otherwise mis-fills.
505 (setq fill-paragraph-handle-comment nil)
506
503 ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a 507 ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a
504 ;; direct call to `fill-paragraph' behaves better. This still 508 ;; direct call to `fill-paragraph' behaves better. This still
505 ;; doesn't work with filladapt but it's better than nothing. 509 ;; doesn't work with filladapt but it's better than nothing.