unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53537: Emacs 28 regression: fill-column is not always respected for the first line of commented block
@ 2022-01-26  0:14 Sergey Vinokurov
  2022-01-26 12:43 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Vinokurov @ 2022-01-26  0:14 UTC (permalink / raw)
  To: 53537

Hello,

The #45720 bug introduces edge case in treatment of fill-column for the 
first line of commented block. This is caught by haskell-mode tests 
(https://github.com/haskell/haskell-mode/blob/master/tests/haskell-mode-tests.el#L330) 
but is not limited to that mode.

I have managed to reproduce it using the following snippet:

(princ
  (with-temp-buffer
    (asm-mode)
    (dolist (line '("  ;; a b c"
                    "  ;; d e f"
                    "  ;; x y z"
                    "  ;; w"))
      (insert line "\n"))
    (goto-char (point-min))
    (end-of-line)
    (setf fill-column 10)
    (fill-paragraph nil)
    (buffer-string)))

The idea is that everything is already filled and nothing should happen 
when fill-column equals to 10.

On Emacs 27 I get the expected output (snippet above is in /tmp/test.el):

$ emacs --version
GNU Emacs 27.2.50
Copyright (C) 2021 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
$ emacs -Q --batch -l /tmp/test.el
   ;; a b c
   ;; d e f
   ;; x y z
   ;; w

On Emacs 28 pretest I get:

$ emacs --version
GNU Emacs 28.0.91
Copyright (C) 2022 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
$ emacs -Q --batch -l /tmp/test.el
   ;; a b c d
   ;; e f x
   ;; y z w

The first line is of length 11 which is in violation of requested 
fill-column equals 10.

Couldn't reproduce for emacs-lisp-mode and c-mode presumably because 
they override fill-paragraph-function so asm-mode is the simplest 
programming related mode I could find in vanilla Emacs. Other modes that 
don't do anything fancy with fill-paragraph-function (e.g. haskell-mode) 
should be susceptible to the issue as well.





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

* bug#53537: Emacs 28 regression: fill-column is not always respected for the first line of commented block
  2022-01-26  0:14 bug#53537: Emacs 28 regression: fill-column is not always respected for the first line of commented block Sergey Vinokurov
@ 2022-01-26 12:43 ` Eli Zaretskii
  2022-01-26 15:19   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2022-01-26 12:43 UTC (permalink / raw)
  To: Sergey Vinokurov, Lars Ingebrigtsen; +Cc: 53537

> Date: Wed, 26 Jan 2022 00:14:21 +0000
> From: Sergey Vinokurov <serg.foo@gmail.com>
> 
> The #45720 bug introduces edge case in treatment of fill-column for the 
> first line of commented block. This is caught by haskell-mode tests 
> (https://github.com/haskell/haskell-mode/blob/master/tests/haskell-mode-tests.el#L330) 
> but is not limited to that mode.
> 
> I have managed to reproduce it using the following snippet:
> 
> (princ
>   (with-temp-buffer
>     (asm-mode)
>     (dolist (line '("  ;; a b c"
>                     "  ;; d e f"
>                     "  ;; x y z"
>                     "  ;; w"))
>       (insert line "\n"))
>     (goto-char (point-min))
>     (end-of-line)
>     (setf fill-column 10)
>     (fill-paragraph nil)
>     (buffer-string)))
> 
> The idea is that everything is already filled and nothing should happen 
> when fill-column equals to 10.

Lars, do we revert the fix for bug#45720, or is there a better idea?





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

* bug#53537: Emacs 28 regression: fill-column is not always respected for the first line of commented block
  2022-01-26 12:43 ` Eli Zaretskii
@ 2022-01-26 15:19   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-26 15:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 53537, Sergey Vinokurov

Eli Zaretskii <eliz@gnu.org> writes:

> Lars, do we revert the fix for bug#45720, or is there a better idea?

I think this needs a lot more work, so I've reverted it in emacs-28, and
added the new test case and left the now-failing old test case, and
reopened #45720.

-- 
(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-01-26 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  0:14 bug#53537: Emacs 28 regression: fill-column is not always respected for the first line of commented block Sergey Vinokurov
2022-01-26 12:43 ` Eli Zaretskii
2022-01-26 15:19   ` 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).