GNU bug report logs - #53537
Emacs 28 regression: fill-column is not always respected for the first line of commented block

Previous Next

Package: emacs;

Reported by: Sergey Vinokurov <serg.foo <at> gmail.com>

Date: Wed, 26 Jan 2022 00:15:01 UTC

Severity: normal

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53537 in the body.
You can then email your comments to 53537 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#53537; Package emacs. (Wed, 26 Jan 2022 00:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sergey Vinokurov <serg.foo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 26 Jan 2022 00:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sergey Vinokurov <serg.foo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Emacs 28 regression: fill-column is not always respected for the
 first line of commented block
Date: Wed, 26 Jan 2022 00:14:21 +0000
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53537; Package emacs. (Wed, 26 Jan 2022 12:45:01 GMT) Full text and rfc822 format available.

Message #8 received at 53537 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sergey Vinokurov <serg.foo <at> gmail.com>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 53537 <at> debbugs.gnu.org
Subject: Re: bug#53537: Emacs 28 regression: fill-column is not always
 respected for the first line of commented block
Date: Wed, 26 Jan 2022 14:43:52 +0200
> Date: Wed, 26 Jan 2022 00:14:21 +0000
> From: Sergey Vinokurov <serg.foo <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53537; Package emacs. (Wed, 26 Jan 2022 15:20:02 GMT) Full text and rfc822 format available.

Message #11 received at 53537 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 53537 <at> debbugs.gnu.org, Sergey Vinokurov <serg.foo <at> gmail.com>
Subject: Re: bug#53537: Emacs 28 regression: fill-column is not always
 respected for the first line of commented block
Date: Wed, 26 Jan 2022 16:19:40 +0100
Eli Zaretskii <eliz <at> 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




bug marked as fixed in version 28.1, send any further explanations to 53537 <at> debbugs.gnu.org and Sergey Vinokurov <serg.foo <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 26 Jan 2022 15:21:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Feb 2022 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 174 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.