From: Alan Mackenzie Date: Fri, 13 Jan 2012 10:59:27 +0000 (+0000) Subject: Fix filling for when filladapt mode is enabled. X-Git-Tag: emacs-pretest-24.0.93~97^2~18 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b493658e2c67e9ae41798edefd7cb9a264e53e99;p=emacs.git Fix filling for when filladapt mode is enabled. --- 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.