Mercurial > emacs
comparison lisp/textmodes/fill.el @ 10497:6e00457b6f86
(fill-region-as-paragraph): At end, advance over any newlines
that were in the region but excluded from filling.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 20 Jan 1995 23:06:06 +0000 |
parents | 95868461fc78 |
children | 3b896847b849 |
comparison
equal
deleted
inserted
replaced
10496:7ffec1b5c86c | 10497:6e00457b6f86 |
---|---|
132 (if (and buffer-undo-list (not (eq buffer-undo-list t))) | 132 (if (and buffer-undo-list (not (eq buffer-undo-list t))) |
133 (setq buffer-undo-list (cons (point) buffer-undo-list))) | 133 (setq buffer-undo-list (cons (point) buffer-undo-list))) |
134 (or justify (setq justify (current-justification))) | 134 (or justify (setq justify (current-justification))) |
135 | 135 |
136 ;; Don't let Adaptive Fill mode alter the fill prefix permanently. | 136 ;; Don't let Adaptive Fill mode alter the fill prefix permanently. |
137 (let ((fill-prefix fill-prefix)) | 137 (let ((fill-prefix fill-prefix) |
138 (skip-after 0)) | |
138 ;; Figure out how this paragraph is indented, if desired. | 139 ;; Figure out how this paragraph is indented, if desired. |
139 (if (and adaptive-fill-mode | 140 (if (and adaptive-fill-mode |
140 (or (null fill-prefix) (string= fill-prefix ""))) | 141 (or (null fill-prefix) (string= fill-prefix ""))) |
141 (save-excursion | 142 (save-excursion |
142 (goto-char (min from to)) | 143 (goto-char (min from to)) |
170 (goto-char (min from to)) | 171 (goto-char (min from to)) |
171 (skip-chars-forward "\n") | 172 (skip-chars-forward "\n") |
172 (setq beg (point)) | 173 (setq beg (point)) |
173 (goto-char (max from to)) | 174 (goto-char (max from to)) |
174 (skip-chars-backward "\n") | 175 (skip-chars-backward "\n") |
176 (setq skip-after (- to (point))) | |
177 ;; If we omit some final newlines from the end of the narrowing, | |
178 ;; arrange to advance past them at the end. | |
175 (setq to (point) | 179 (setq to (point) |
176 from beg) | 180 from beg) |
177 (goto-char from) | 181 (goto-char from) |
178 (beginning-of-line) | 182 (beginning-of-line) |
179 (narrow-to-region (point) to)) | 183 (narrow-to-region (point) to)) |
305 (if justify | 309 (if justify |
306 (if (eobp) | 310 (if (eobp) |
307 (justify-current-line justify t t) | 311 (justify-current-line justify t t) |
308 (forward-line -1) | 312 (forward-line -1) |
309 (justify-current-line justify nil t) | 313 (justify-current-line justify nil t) |
310 (forward-line 1))))))))) | 314 (forward-line 1)))))) |
315 (forward-char skip-after)))) | |
311 | 316 |
312 (defun fill-paragraph (arg) | 317 (defun fill-paragraph (arg) |
313 "Fill paragraph at or after point. Prefix arg means justify as well. | 318 "Fill paragraph at or after point. Prefix arg means justify as well. |
314 If `sentence-end-double-space' is non-nil, then period followed by one | 319 If `sentence-end-double-space' is non-nil, then period followed by one |
315 space does not end a sentence, so don't break a line there." | 320 space does not end a sentence, so don't break a line there." |