diff options
author | Richard M. Stallman <[email protected]> | 2003-05-28 11:30:48 +0000 |
---|---|---|
committer | Richard M. Stallman <[email protected]> | 2003-05-28 11:30:48 +0000 |
commit | 8b4703c468565c545b6ff0a34ae2ee1184f68a60 (patch) | |
tree | 2db8debaae31eb1ed81855912fbad8dc15ea8f72 /lisp/textmodes/refill.el | |
parent | 4532ac55a9f3f87863a4eb658845afa525fef410 (diff) |
(refill-fill-paragraph-at): Avoid refilling the following paragraph.
(refill-doit): Doc fix.
Diffstat (limited to 'lisp/textmodes/refill.el')
-rw-r--r-- | lisp/textmodes/refill.el | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el index 22aba1cbbe..4d5d6db35c 100644 --- a/lisp/textmodes/refill.el +++ b/lisp/textmodes/refill.el @@ -110,49 +110,51 @@ This is used to optimize refilling.") (let (fill-pfx) (save-excursion (goto-char pos) - ;; FIXME: forward-paragraph seems to disregard `use-hard-newlines', - ;; leading to excessive refilling and wrong choice of fill-prefix. - ;; might be a bug in my paragraphs.el. - (forward-paragraph) - (skip-syntax-backward "-") - (let ((end (point)) - (beg (progn (backward-paragraph) (point))) - (obeg (overlay-start refill-ignorable-overlay)) - (oend (overlay-end refill-ignorable-overlay))) - (goto-char pos) - (if (and (>= beg obeg) (< beg oend)) - ;; Limit filling to the modified tail of the paragraph. - (let (;; When adaptive-fill-mode is enabled, the filling - ;; functions will attempt to set the fill prefix from - ;; the fake paragraph bounds we pass in, so set it - ;; ourselves first, using the real paragraph bounds. - (fill-prefix - (if (and adaptive-fill-mode - (or (null fill-prefix) (string= fill-prefix ""))) - (fill-context-prefix beg end) - fill-prefix)) - ;; Turn off adaptive-fill-mode temporarily - (adaptive-fill-mode nil)) - (save-restriction - (if use-hard-newlines - (fill-region oend end arg) - (fill-region-as-paragraph oend end arg))) - (setq fill-pfx fill-prefix) - (move-overlay refill-ignorable-overlay obeg (point))) - ;; Fill the whole paragraph - (setq fill-pfx + (unless (or (and (bolp) (eolp)) + (save-match-data (looking-at "\n\n"))) + ;; FIXME: forward-paragraph seems to disregard `use-hard-newlines', + ;; leading to excessive refilling and wrong choice of fill-prefix. + ;; might be a bug in my paragraphs.el. + (forward-paragraph) + (skip-syntax-backward "-") + (let ((end (point)) + (beg (progn (backward-paragraph) (point))) + (obeg (overlay-start refill-ignorable-overlay)) + (oend (overlay-end refill-ignorable-overlay))) + (goto-char pos) + (if (and (>= beg obeg) (< beg oend)) + ;; Limit filling to the modified tail of the paragraph. + (let ( ;; When adaptive-fill-mode is enabled, the filling + ;; functions will attempt to set the fill prefix from + ;; the fake paragraph bounds we pass in, so set it + ;; ourselves first, using the real paragraph bounds. + (fill-prefix + (if (and adaptive-fill-mode + (or (null fill-prefix) (string= fill-prefix ""))) + (fill-context-prefix beg end) + fill-prefix)) + ;; Turn off adaptive-fill-mode temporarily + (adaptive-fill-mode nil)) (save-restriction (if use-hard-newlines - (fill-region beg end arg) - (fill-region-as-paragraph beg end arg)))) - (move-overlay refill-ignorable-overlay beg (point))))))) + (fill-region oend end arg) + (fill-region-as-paragraph oend end arg))) + (setq fill-pfx fill-prefix) + (move-overlay refill-ignorable-overlay obeg (point))) + ;; Fill the whole paragraph + (setq fill-pfx + (save-restriction + (if use-hard-newlines + (fill-region beg end arg) + (fill-region-as-paragraph beg end arg)))) + (move-overlay refill-ignorable-overlay beg (point)))))))) (defun refill-fill-paragraph (arg) "Like `fill-paragraph' but don't delete whitespace at paragraph end." (refill-fill-paragraph-at (point) arg)) (defvar refill-doit nil - "Non-nil means that `refill-post-command-function' does its processing. + "Non-nil tells `refill-post-command-function' to do its processing. Set by `refill-after-change-function' in `after-change-functions' and unset by `refill-post-command-function' in `post-command-hook', and sometimes `refill-pre-command-function' in `pre-command-hook'. This |