unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Fix fill-flowed for large or nil values of fill-flowed-display-column
@ 2022-01-27 12:13 Matthias Schmitt
  2022-01-27 13:36 ` Matthias Schmitt
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Schmitt @ 2022-01-27 12:13 UTC (permalink / raw)
  To: emacs-devel

Hi,

`fill-flowed` currently does not work correctly when the variable 
`fill-flowed-display-column` is large or nil (no hard line breaks 
e.g. when using `visual-fill-column-mode`).
The origin of this behavior is that if `fill-region` does not 
break the current line but the current line should be merged with 
the next line moving a line forward is an error.

This patch is a rather dirty fix that checks if the current line 
should be merged with the following line (ending in SPC CRLF) 
before moving over it.


This is my first contribution to Emacs and the mailing list and I 
am happy to be a small part of the development of Emacs :)

Cheers,
Matthias


diff -u --label \#\<buffer\ flow-fill.el.gz\> --label \#\<buffer\ 
flow-fill.buffer\> /tmp/buffer-content-nY7QFh 
/tmp/buffer-content-zqOgJ3
--- #<buffer flow-fill.el.gz>
+++ #<buffer flow-fill.buffer>
@@ -157,11 +157,12 @@
               (delete-char -1))
             (delete-char 1)
             (ignore-errors
-		(let ((fill-prefix ""))
-		  (fill-region (line-beginning-position)
-                               (line-end-position)
-			       'left 'nosqueeze))))))
-        (forward-line 1)))))
+              (let ((fill-prefix ""))
+                (fill-region (line-beginning-position)
+                             (line-end-position)
+                             'left 'nosqueeze))))))
+        (unless (eq (char-before (line-end-position)) ?\s)
+          (forward-line 1))))))
 
 (make-obsolete-variable 'fill-flowed-encode-tests nil "27.1")
 (defvar fill-flowed-encode-tests)

Diff finished.  Thu Jan 27 13:06:47 2022



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix fill-flowed for large or nil values of fill-flowed-display-column
  2022-01-27 12:13 Fix fill-flowed for large or nil values of fill-flowed-display-column Matthias Schmitt
@ 2022-01-27 13:36 ` Matthias Schmitt
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias Schmitt @ 2022-01-27 13:36 UTC (permalink / raw)
  To: emacs-devel


The previous patch broke `fill-flow` for quoted text a 
`beginning-of-line` call fixes that.


--- #<buffer flow-fill.el.gz>
+++ #<buffer flow-fill.buffer>
@@ -140,11 +140,11 @@
               ;; next line.
               (delete-region (point) (match-end 1))
               (ignore-errors
-		  (let ((fill-prefix (concat prefix " "))
-		        adaptive-fill-mode)
-		    (fill-region (line-beginning-position)
-                                 (line-end-position)
-			         'left 'nosqueeze))))))
+                (let ((fill-prefix (concat prefix " "))
+                      adaptive-fill-mode)
+                  (fill-region (line-beginning-position)
+                               (line-end-position)
+                               'left 'nosqueeze))))))
          (t
           ;; Delete the newline.
           (when (eq (following-char) ?\s)
@@ -157,11 +157,13 @@
               (delete-char -1))
             (delete-char 1)
             (ignore-errors
-		(let ((fill-prefix ""))
-		  (fill-region (line-beginning-position)
-                               (line-end-position)
-			       'left 'nosqueeze))))))
-        (forward-line 1)))))
+              (let ((fill-prefix ""))
+                (fill-region (line-beginning-position)
+                             (line-end-position)
+                             'left 'nosqueeze))))))
+        (unless (eq (char-before (line-end-position)) ?\s)
+          (forward-line 1))
+        (beginning-of-line)))))
 
 (make-obsolete-variable 'fill-flowed-encode-tests nil "27.1")
 (defvar fill-flowed-encode-tests)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-27 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-27 12:13 Fix fill-flowed for large or nil values of fill-flowed-display-column Matthias Schmitt
2022-01-27 13:36 ` Matthias Schmitt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).