Mercurial > emacs
comparison lisp/textmodes/fill.el @ 14113:dfbb4ab9bee1
(fill-region-as-paragraph): Check again for reaching
the end of the paragraph, after we adjust for places we can't break
and make sure to keep at least one word.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 09 Jan 1996 23:18:07 +0000 |
parents | 6758b889a7c1 |
children | 83f275dcd93a |
comparison
equal
deleted
inserted
replaced
14112:271075f54794 | 14113:dfbb4ab9bee1 |
---|---|
195 | 195 |
196 (beginning-of-line) | 196 (beginning-of-line) |
197 (setq from (point)) | 197 (setq from (point)) |
198 | 198 |
199 ;; Delete all but one soft newline at end of region. | 199 ;; Delete all but one soft newline at end of region. |
200 ;; And leave TO before that one. | |
200 (goto-char to) | 201 (goto-char to) |
201 (while (and (> (point) from) (eq ?\n (char-after (1- (point))))) | 202 (while (and (> (point) from) (eq ?\n (char-after (1- (point))))) |
202 (if (and oneleft | 203 (if (and oneleft |
203 (not (and use-hard-newlines | 204 (not (and use-hard-newlines |
204 (get-text-property (1- (point)) 'hard)))) | 205 (get-text-property (1- (point)) 'hard)))) |
360 (and (looking-at "\\. ") | 361 (and (looking-at "\\. ") |
361 (not (looking-at "\\. "))))))) | 362 (not (looking-at "\\. "))))))) |
362 (skip-chars-forward " \t") | 363 (skip-chars-forward " \t") |
363 (skip-chars-forward "^ \t\n") | 364 (skip-chars-forward "^ \t\n") |
364 (setq first nil)))) | 365 (setq first nil)))) |
365 ;; Replace whitespace here with one newline, then indent to left | 366 ;; Check again to see if we got to the end of the paragraph. |
366 ;; margin. | 367 (if (eobp) |
367 (skip-chars-backward " \t") | 368 (or nosqueeze (delete-horizontal-space)) |
368 (insert ?\n) | 369 ;; Replace whitespace here with one newline, then indent to left |
369 ;; Give newline the properties of the space(s) it replaces | 370 ;; margin. |
370 (set-text-properties (1- (point)) (point) | 371 (skip-chars-backward " \t") |
371 (text-properties-at (point))) | 372 (insert ?\n) |
372 (indent-to-left-margin) | 373 ;; Give newline the properties of the space(s) it replaces |
373 ;; Insert the fill prefix after indentation. | 374 (set-text-properties (1- (point)) (point) |
374 ;; Set prefixcol so whitespace in the prefix won't get lost. | 375 (text-properties-at (point))) |
375 (and fill-prefix (not (equal fill-prefix "")) | 376 (indent-to-left-margin) |
376 (progn | 377 ;; Insert the fill prefix after indentation. |
377 (insert-and-inherit fill-prefix) | 378 ;; Set prefixcol so whitespace in the prefix won't get lost. |
378 (setq prefixcol (current-column))))) | 379 (and fill-prefix (not (equal fill-prefix "")) |
380 (progn | |
381 (insert-and-inherit fill-prefix) | |
382 (setq prefixcol (current-column)))))) | |
379 ;; Justify the line just ended, if desired. | 383 ;; Justify the line just ended, if desired. |
380 (if justify | 384 (if justify |
381 (if (eobp) | 385 (if (eobp) |
382 (justify-current-line justify t t) | 386 (justify-current-line justify t t) |
383 (forward-line -1) | 387 (forward-line -1) |