diff options
| author | Richard M. Stallman | 2003-05-28 11:30:48 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-05-28 11:30:48 +0000 |
| commit | 8b4703c468565c545b6ff0a34ae2ee1184f68a60 (patch) | |
| tree | 2db8debaae31eb1ed81855912fbad8dc15ea8f72 | |
| parent | 4532ac55a9f3f87863a4eb658845afa525fef410 (diff) | |
| download | emacs-8b4703c468565c545b6ff0a34ae2ee1184f68a60.tar.gz emacs-8b4703c468565c545b6ff0a34ae2ee1184f68a60.zip | |
(refill-fill-paragraph-at): Avoid refilling the following paragraph.
(refill-doit): Doc fix.
| -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 22aba1cbbe3..4d5d6db35c4 100644 --- a/lisp/textmodes/refill.el +++ b/lisp/textmodes/refill.el | |||
| @@ -110,49 +110,51 @@ This is used to optimize refilling.") | |||
| 110 | (let (fill-pfx) | 110 | (let (fill-pfx) |
| 111 | (save-excursion | 111 | (save-excursion |
| 112 | (goto-char pos) | 112 | (goto-char pos) |
| 113 | ;; FIXME: forward-paragraph seems to disregard `use-hard-newlines', | 113 | (unless (or (and (bolp) (eolp)) |
| 114 | ;; leading to excessive refilling and wrong choice of fill-prefix. | 114 | (save-match-data (looking-at "\n\n"))) |
| 115 | ;; might be a bug in my paragraphs.el. | 115 | ;; FIXME: forward-paragraph seems to disregard `use-hard-newlines', |
| 116 | (forward-paragraph) | 116 | ;; leading to excessive refilling and wrong choice of fill-prefix. |
| 117 | (skip-syntax-backward "-") | 117 | ;; might be a bug in my paragraphs.el. |
| 118 | (let ((end (point)) | 118 | (forward-paragraph) |
| 119 | (beg (progn (backward-paragraph) (point))) | 119 | (skip-syntax-backward "-") |
| 120 | (obeg (overlay-start refill-ignorable-overlay)) | 120 | (let ((end (point)) |
| 121 | (oend (overlay-end refill-ignorable-overlay))) | 121 | (beg (progn (backward-paragraph) (point))) |
| 122 | (goto-char pos) | 122 | (obeg (overlay-start refill-ignorable-overlay)) |
| 123 | (if (and (>= beg obeg) (< beg oend)) | 123 | (oend (overlay-end refill-ignorable-overlay))) |
| 124 | ;; Limit filling to the modified tail of the paragraph. | 124 | (goto-char pos) |
| 125 | (let (;; When adaptive-fill-mode is enabled, the filling | 125 | (if (and (>= beg obeg) (< beg oend)) |
| 126 | ;; functions will attempt to set the fill prefix from | 126 | ;; Limit filling to the modified tail of the paragraph. |
| 127 | ;; the fake paragraph bounds we pass in, so set it | 127 | (let ( ;; When adaptive-fill-mode is enabled, the filling |
| 128 | ;; ourselves first, using the real paragraph bounds. | 128 | ;; functions will attempt to set the fill prefix from |
| 129 | (fill-prefix | 129 | ;; the fake paragraph bounds we pass in, so set it |
| 130 | (if (and adaptive-fill-mode | 130 | ;; ourselves first, using the real paragraph bounds. |
| 131 | (or (null fill-prefix) (string= fill-prefix ""))) | 131 | (fill-prefix |
| 132 | (fill-context-prefix beg end) | 132 | (if (and adaptive-fill-mode |
| 133 | fill-prefix)) | 133 | (or (null fill-prefix) (string= fill-prefix ""))) |
| 134 | ;; Turn off adaptive-fill-mode temporarily | 134 | (fill-context-prefix beg end) |
| 135 | (adaptive-fill-mode nil)) | 135 | fill-prefix)) |
| 136 | (save-restriction | 136 | ;; Turn off adaptive-fill-mode temporarily |
| 137 | (if use-hard-newlines | 137 | (adaptive-fill-mode nil)) |
| 138 | (fill-region oend end arg) | ||
| 139 | (fill-region-as-paragraph oend end arg))) | ||
| 140 | (setq fill-pfx fill-prefix) | ||
| 141 | (move-overlay refill-ignorable-overlay obeg (point))) | ||
| 142 | ;; Fill the whole paragraph | ||
| 143 | (setq fill-pfx | ||
| 144 | (save-restriction | 138 | (save-restriction |
| 145 | (if use-hard-newlines | 139 | (if use-hard-newlines |
| 146 | (fill-region beg end arg) | 140 | (fill-region oend end arg) |
| 147 | (fill-region-as-paragraph beg end arg)))) | 141 | (fill-region-as-paragraph oend end arg))) |
| 148 | (move-overlay refill-ignorable-overlay beg (point))))))) | 142 | (setq fill-pfx fill-prefix) |
| 143 | (move-overlay refill-ignorable-overlay obeg (point))) | ||
| 144 | ;; Fill the whole paragraph | ||
| 145 | (setq fill-pfx | ||
| 146 | (save-restriction | ||
| 147 | (if use-hard-newlines | ||
| 148 | (fill-region beg end arg) | ||
| 149 | (fill-region-as-paragraph beg end arg)))) | ||
| 150 | (move-overlay refill-ignorable-overlay beg (point)))))))) | ||
| 149 | 151 | ||
| 150 | (defun refill-fill-paragraph (arg) | 152 | (defun refill-fill-paragraph (arg) |
| 151 | "Like `fill-paragraph' but don't delete whitespace at paragraph end." | 153 | "Like `fill-paragraph' but don't delete whitespace at paragraph end." |
| 152 | (refill-fill-paragraph-at (point) arg)) | 154 | (refill-fill-paragraph-at (point) arg)) |
| 153 | 155 | ||
| 154 | (defvar refill-doit nil | 156 | (defvar refill-doit nil |
| 155 | "Non-nil means that `refill-post-command-function' does its processing. | 157 | "Non-nil tells `refill-post-command-function' to do its processing. |
| 156 | Set by `refill-after-change-function' in `after-change-functions' and | 158 | Set by `refill-after-change-function' in `after-change-functions' and |
| 157 | unset by `refill-post-command-function' in `post-command-hook', and | 159 | unset by `refill-post-command-function' in `post-command-hook', and |
| 158 | sometimes `refill-pre-command-function' in `pre-command-hook'. This | 160 | sometimes `refill-pre-command-function' in `pre-command-hook'. This |