diff options
| author | Lars Ingebrigtsen | 2021-03-24 10:23:07 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-03-24 10:23:14 +0100 |
| commit | 8d334132456dfcbe5b5c3e59737dbfd0a4ea4c0d (patch) | |
| tree | 90b72db2011d02d16d0e133dc1aeda3d8c6c56e9 /lisp/textmodes | |
| parent | 8b07994e201e478df8a3431cbae5187b4cde1791 (diff) | |
| download | emacs-8d334132456dfcbe5b5c3e59737dbfd0a4ea4c0d.tar.gz emacs-8d334132456dfcbe5b5c3e59737dbfd0a4ea4c0d.zip | |
Fix problem with filling with a computed fill prefix
* lisp/textmodes/fill.el (fill-region-as-paragraph): Fix problem
when filling text with a computed fill prefix (bug#47338).
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/fill.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 81cd2f02cd7..cb5027a9763 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el | |||
| @@ -703,7 +703,8 @@ space does not end a sentence, so don't break a line there." | |||
| 703 | (or justify (setq justify (current-justification))) | 703 | (or justify (setq justify (current-justification))) |
| 704 | 704 | ||
| 705 | ;; Don't let Adaptive Fill mode alter the fill prefix permanently. | 705 | ;; Don't let Adaptive Fill mode alter the fill prefix permanently. |
| 706 | (let ((fill-prefix fill-prefix)) | 706 | (let ((actual-fill-prefix fill-prefix) |
| 707 | (fill-prefix fill-prefix)) | ||
| 707 | ;; Figure out how this paragraph is indented, if desired. | 708 | ;; Figure out how this paragraph is indented, if desired. |
| 708 | (when (and adaptive-fill-mode | 709 | (when (and adaptive-fill-mode |
| 709 | (or (null fill-prefix) (string= fill-prefix ""))) | 710 | (or (null fill-prefix) (string= fill-prefix ""))) |
| @@ -717,7 +718,7 @@ space does not end a sentence, so don't break a line there." | |||
| 717 | (goto-char from) | 718 | (goto-char from) |
| 718 | (beginning-of-line) | 719 | (beginning-of-line) |
| 719 | 720 | ||
| 720 | (if (not justify) ; filling disabled: just check indentation | 721 | (if (not justify) ; filling disabled: just check indentation |
| 721 | (progn | 722 | (progn |
| 722 | (goto-char from) | 723 | (goto-char from) |
| 723 | (while (< (point) to) | 724 | (while (< (point) to) |
| @@ -747,12 +748,14 @@ space does not end a sentence, so don't break a line there." | |||
| 747 | linebeg) | 748 | linebeg) |
| 748 | (while (< (point) to) | 749 | (while (< (point) to) |
| 749 | ;; On the first line, there may be text in the fill prefix | 750 | ;; On the first line, there may be text in the fill prefix |
| 750 | ;; zone. In that case, don't consider that area when | 751 | ;; zone (when `fill-prefix' is specified externally, and |
| 751 | ;; trying to find a place to put a line break (bug#45720). | 752 | ;; not computed). In that case, don't consider that area |
| 753 | ;; when trying to find a place to put a line break | ||
| 754 | ;; (bug#45720). | ||
| 752 | (if (not first) | 755 | (if (not first) |
| 753 | (setq linebeg (point)) | 756 | (setq linebeg (point)) |
| 754 | (setq first nil | 757 | (setq first nil |
| 755 | linebeg (+ (point) (length fill-prefix)))) | 758 | linebeg (+ (point) (length actual-fill-prefix)))) |
| 756 | (move-to-column (current-fill-column)) | 759 | (move-to-column (current-fill-column)) |
| 757 | (if (when (< (point) to) | 760 | (if (when (< (point) to) |
| 758 | ;; Find the position where we'll break the line. | 761 | ;; Find the position where we'll break the line. |