unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45720: 28.0.50; fill-region-as-paragraph with long unbreakable lines
@ 2021-01-07 23:52 Roland Winkler
  2021-01-10 14:06 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Roland Winkler @ 2021-01-07 23:52 UTC (permalink / raw)
  To: 45720


In emacs -Q evaluate

(defun foo (pos)
  (interactive "d")
  (let* ((beg (line-beginning-position))
         (end (line-end-position))
         (fill-prefix (make-string (- pos beg) ?\s))
         ;; `fill-column' is too small to accomodate the current line
         (fill-column (- end beg 10)))
    (fill-region-as-paragraph beg end nil nil pos)))

Then put point on letter `b' of the following line and run M-x foo

aaa =   baaaaaaaaaaaaaaaaaaaaaaaaaaaa

This fills the line as

aaa =
        baaaaaaaaaaaaaaaaaaaaaaaaaaaa

The line break introduced here does not make sense.  The line should
be kept what it was.

Command `foo' is really the essence of bibtex-fill-field-bounds in
textmodes/bibtex.el that uses fill-region-as-paragraph to fill the
fields of BibTeX entries.  If the field holds a URL, it may happen
more easily that the value of the field is a string that goes beyond
fill-column and that fill-region-as-paragraph cannot break into
words.  I haven't tried to construct a yet more minimalistic version
of this problem.



In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9, cairo version 1.14.6)
 of 2021-01-03 built on regnitz
Repository revision: 20ad0cc03b73f6576ece195bb16878415c313d45
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description: Ubuntu 16.04.7 LTS





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

* bug#45720: 28.0.50; fill-region-as-paragraph with long unbreakable lines
  2021-01-07 23:52 bug#45720: 28.0.50; fill-region-as-paragraph with long unbreakable lines Roland Winkler
@ 2021-01-10 14:06 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-10 14:06 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 45720

"Roland Winkler" <winkler@gnu.org> writes:

> Then put point on letter `b' of the following line and run M-x foo
>
> aaa =   baaaaaaaaaaaaaaaaaaaaaaaaaaaa
>
> This fills the line as
>
> aaa =
>         baaaaaaaaaaaaaaaaaaaaaaaaaaaa
>
> The line break introduced here does not make sense.  The line should
> be kept what it was.

Yup.  Looking at the code, this looked suspiciously easy to fix.
However, there's absolutely no tests for this stuff, so my confidence
that I didn't break anything here is pretty low.  I've added a couple
tests (based on your test case) and pushed it to the trunk, though.  Let
me know whether it works in your real cases or not:

> Command `foo' is really the essence of bibtex-fill-field-bounds in
> textmodes/bibtex.el that uses fill-region-as-paragraph to fill the
> fields of BibTeX entries.  If the field holds a URL, it may happen
> more easily that the value of the field is a string that goes beyond
> fill-column and that fill-region-as-paragraph cannot break into
> words.  I haven't tried to construct a yet more minimalistic version
> of this problem.

Or whether this breaks something else, and if it does, please do feel
free to add more tests to test/lisp/textmodes/fill-tests.el.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#45720: 28.0.50; fill-region-as-paragraph with long unbreakable lines
       [not found] <87y232r0ee.fsf@gnus.org>
@ 2022-06-07 14:54 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-07 14:54 UTC (permalink / raw)
  To: 45720

Lars Ingebrigtsen <larsi@gnus.org> writes:

> reopen 45720
> tags 45720 - fixed patch
> quit

This was reopened because of:

commit c9524819eaf4e561a184b04dfca7e42970dc8809
Author:     Lars Ingebrigtsen <larsi@gnus.org>
AuthorDate: Wed Jan 26 16:17:49 2022 +0100
Commit:     Lars Ingebrigtsen <larsi@gnus.org>
CommitDate: Wed Jan 26 16:20:05 2022 +0100

    Partially revert a fill-region-as-paragraph regression
    
    * lisp/textmodes/fill.el (fill-region-as-paragraph): Revert
    e186af261 (bug#53537), because it leads to regressions.  (But
    leave tests in place.)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2022-06-07 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 23:52 bug#45720: 28.0.50; fill-region-as-paragraph with long unbreakable lines Roland Winkler
2021-01-10 14:06 ` Lars Ingebrigtsen
     [not found] <87y232r0ee.fsf@gnus.org>
2022-06-07 14:54 ` Lars Ingebrigtsen

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).