diff options
author | Alan Mackenzie <acm@muc.de> | 2012-01-13 10:59:27 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2012-01-13 10:59:27 +0000 |
commit | b493658e2c67e9ae41798edefd7cb9a264e53e99 (patch) | |
tree | db5b0a59b476e054a68d6f69acffc6b5c6379848 | |
parent | e517eda4d0d6da5d4b8f12be1608fb5e17c455ff (diff) | |
download | emacs-b493658e2c67e9ae41798edefd7cb9a264e53e99.tar.gz |
Fix filling for when filladapt mode is enabled.
-rw-r--r-- | lisp/progmodes/cc-cmds.el | 7 | ||||
-rw-r--r-- | lisp/progmodes/cc-mode.el | 4 |
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." (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. 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." (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. |