GNU bug report logs - #71499
[PATCH] Make whitespace.el cleanup add missing final newline

Previous Next

Package: emacs;

Reported by: Björn Lindström <bkhl <at> elektrubadur.se>

Date: Wed, 12 Jun 2024 04:45:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.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 71499 in the body.
You can then email your comments to 71499 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#71499; Package emacs. (Wed, 12 Jun 2024 04:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Björn Lindström <bkhl <at> elektrubadur.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 12 Jun 2024 04:45:02 GMT) Full text and rfc822 format available.

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

From: Björn Lindström <bkhl <at> elektrubadur.se>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Make whitespace.el cleanup add missing final newline
Date: Tue, 11 Jun 2024 20:16:03 +0200
[Message part 1 (text/plain, inline)]
Hello,

attaching patch to make the whitespace-cleanup and whitespace-cleanup-region functions add a final newline to a file if whitespace-style contains `missing-newline-at-eof

I'm aware this somewhat replicates what setting `require-final-newline would do, but I think since whitespace.el with this configuration highlights this as an error, it should also clean it up when asked.

Best wishes,
Björn
[0001-Make-whitespace.el-cleanup-add-missing-final-newline.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Wed, 12 Jun 2024 05:22:01 GMT) Full text and rfc822 format available.

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

From: Björn Lindström <bkhl <at> elektrubadur.se>
To: 71499 <at> debbugs.gnu.org
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Wed, 12 Jun 2024 07:21:04 +0200
[Message part 1 (text/plain, inline)]
On Tue, Jun 11, 2024, at 20:16, Björn Lindström wrote:
> Hello,
>
> attaching patch to make the whitespace-cleanup and 
> whitespace-cleanup-region functions add a final newline to a file if 
> whitespace-style contains `missing-newline-at-eof
>
> I'm aware this somewhat replicates what setting `require-final-newline 
> would do, but I think since whitespace.el with this configuration 
> highlights this as an error, it should also clean it up when asked.
>
> Best wishes,
> Björn
> Attachments:
> * 0001-Make-whitespace.el-cleanup-add-missing-final-newline.patch

Sorry, somehow messed up the first patch I sent, now attaching a corrected one. Attaching the correct one here.

Best wishes,
Björn
[0001-Make-whitespace.el-cleanup-add-missing-final-newline-2.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Wed, 12 Jun 2024 07:48:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Björn Lindström <bkhl <at> elektrubadur.se>
Cc: 71499 <at> debbugs.gnu.org
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Wed, 12 Jun 2024 10:46:52 +0300
> Date: Tue, 11 Jun 2024 20:16:03 +0200
> From: Björn Lindström <bkhl <at> elektrubadur.se>
> 
> attaching patch to make the whitespace-cleanup and whitespace-cleanup-region functions add a final newline to a file if whitespace-style contains `missing-newline-at-eof
> 
> I'm aware this somewhat replicates what setting `require-final-newline would do, but I think since whitespace.el with this configuration highlights this as an error, it should also clean it up when asked.

This is an incompatible change of behavior on behalf of
whitespace-cleanup, so I don't think we can accept it as in this patch
(or the next one you sent).  Se we'd need some new user option, by
default off, to turn on this new feature.  Or maybe a new action for
whitespace-action?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Wed, 12 Jun 2024 09:05:02 GMT) Full text and rfc822 format available.

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

From: Björn Lindström <bkhl <at> elektrubadur.se>
To: "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 71499 <at> debbugs.gnu.org
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Wed, 12 Jun 2024 11:04:18 +0200
On Wed, Jun 12, 2024, at 09:46, Eli Zaretskii wrote:
>> Date: Tue, 11 Jun 2024 20:16:03 +0200
>> From: Björn Lindström <bkhl <at> elektrubadur.se>
>> 
>> attaching patch to make the whitespace-cleanup and whitespace-cleanup-region functions add a final newline to a file if whitespace-style contains `missing-newline-at-eof
>> 
>> I'm aware this somewhat replicates what setting `require-final-newline would do, but I think since whitespace.el with this configuration highlights this as an error, it should also clean it up when asked.
>
> This is an incompatible change of behavior on behalf of
> whitespace-cleanup, so I don't think we can accept it as in this patch
> (or the next one you sent).  Se we'd need some new user option, by
> default off, to turn on this new feature.  Or maybe a new action for
> whitespace-action?
>
> Thanks.

Hello,

I thought about that, but since whitespace-cleanup generally applies clean-up according to white-space style, I thought it was simply an oversight that it doesn't apply a fix when it is set to highlight missing end-of-file newline.

Adding a separate way to configure this removes the simplicity of configuring your preferred whitespace-style as a single option.

However, If you still disagree I can make another patch somehow maintains the old behaviour as the default, so just let me know.

Thanks,
Björn




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Wed, 12 Jun 2024 09:42:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Björn Lindström <bkhl <at> elektrubadur.se>,
 Stefan Kangas <stefankangas <at> gmail.com>, Andrea Corallo <acorallo <at> gnu.org>
Cc: 71499 <at> debbugs.gnu.org
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Wed, 12 Jun 2024 12:41:33 +0300
> Date: Wed, 12 Jun 2024 11:04:18 +0200
> From: Björn Lindström <bkhl <at> elektrubadur.se>
> Cc: 71499 <at> debbugs.gnu.org
> 
> On Wed, Jun 12, 2024, at 09:46, Eli Zaretskii wrote:
> >> Date: Tue, 11 Jun 2024 20:16:03 +0200
> >> From: Björn Lindström <bkhl <at> elektrubadur.se>
> >> 
> > This is an incompatible change of behavior on behalf of
> > whitespace-cleanup, so I don't think we can accept it as in this patch
> > (or the next one you sent).  Se we'd need some new user option, by
> > default off, to turn on this new feature.  Or maybe a new action for
> > whitespace-action?
> >
> > Thanks.
> 
> Hello,
> 
> I thought about that, but since whitespace-cleanup generally applies clean-up according to white-space style, I thought it was simply an oversight that it doesn't apply a fix when it is set to highlight missing end-of-file newline.
> 
> Adding a separate way to configure this removes the simplicity of configuring your preferred whitespace-style as a single option.
> 
> However, If you still disagree I can make another patch somehow maintains the old behaviour as the default, so just let me know.

Let's see what others think, and take it from there.

Stefan, Andrea: WDYT about this change?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Wed, 12 Jun 2024 12:41:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>,
 Björn Lindström <bkhl <at> elektrubadur.se>, 
 Andrea Corallo <acorallo <at> gnu.org>
Cc: 71499 <at> debbugs.gnu.org
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Wed, 12 Jun 2024 12:38:57 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> I thought about that, but since whitespace-cleanup generally applies
>> clean-up according to white-space style, I thought it was simply an
>> oversight that it doesn't apply a fix when it is set to highlight
>> missing end-of-file newline.
>>
>> Adding a separate way to configure this removes the simplicity of
>> configuring your preferred whitespace-style as a single option.
>>
>> However, If you still disagree I can make another patch somehow
>> maintains the old behaviour as the default, so just let me know.
>
> Let's see what others think, and take it from there.
>
> Stefan, Andrea: WDYT about this change?

AFAIU, the purpose of whitespace.el is to detect and eventually fix
incorrect whitespace, and it has two ways of doing this:

- Visual highlighting
- Commands to fix problems (`whitespace-report` and
  `whitespace-cleanup).

Since it is mostly configured in the centralized option,
`whitespace-style`, it seems natural that if a user wants to detect
`missing-newline-at-eof`, she would also want this to be fixed by
`whitespace-cleanup`.  This seems even more natural given that
`whitespace-report` already considers that a problem worthy of
reporting.  IOW, I tend to agree that this not already being the case
looks like an oversight.

So I think the existing options are fine, and the patch could go in
as-is, despite the fact that it is backwards-incompatible.  If users
really hate it, I guess we will hear about it and can react.

If we want to be really cautious, we might want to consider waiting with
this change until Emacs 31.  That should provide ample time for people
to notice the new behaviour and react.

My two cents.

BTW, note that we have `require-final-newline` as well, which is what I
use here (in combination with `delete-trailing-whitespace` and the
third-party package `ws-butler`).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Thu, 13 Jun 2024 07:39:02 GMT) Full text and rfc822 format available.

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

From: Andrea Corallo <acorallo <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 Björn Lindström <bkhl <at> elektrubadur.se>,
 71499 <at> debbugs.gnu.org
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Thu, 13 Jun 2024 03:38:42 -0400
Stefan Kangas <stefankangas <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> I thought about that, but since whitespace-cleanup generally applies
>>> clean-up according to white-space style, I thought it was simply an
>>> oversight that it doesn't apply a fix when it is set to highlight
>>> missing end-of-file newline.
>>>
>>> Adding a separate way to configure this removes the simplicity of
>>> configuring your preferred whitespace-style as a single option.
>>>
>>> However, If you still disagree I can make another patch somehow
>>> maintains the old behaviour as the default, so just let me know.
>>
>> Let's see what others think, and take it from there.
>>
>> Stefan, Andrea: WDYT about this change?
>
> AFAIU, the purpose of whitespace.el is to detect and eventually fix
> incorrect whitespace, and it has two ways of doing this:
>
> - Visual highlighting
> - Commands to fix problems (`whitespace-report` and
>   `whitespace-cleanup).
>
> Since it is mostly configured in the centralized option,
> `whitespace-style`, it seems natural that if a user wants to detect
> `missing-newline-at-eof`, she would also want this to be fixed by
> `whitespace-cleanup`.  This seems even more natural given that
> `whitespace-report` already considers that a problem worthy of
> reporting.  IOW, I tend to agree that this not already being the case
> looks like an oversight.
>
> So I think the existing options are fine, and the patch could go in
> as-is, despite the fact that it is backwards-incompatible.  If users
> really hate it, I guess we will hear about it and can react.
>
> If we want to be really cautious, we might want to consider waiting with
> this change until Emacs 31.  That should provide ample time for people
> to notice the new behaviour and react.
>
> My two cents.

I'm as well for having the patch in, but I guess would be safer in 31 so
we have plenty of time to react if needed.

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Thu, 13 Jun 2024 08:32:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: 71499 <at> debbugs.gnu.org, stefankangas <at> gmail.com, bkhl <at> elektrubadur.se
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Thu, 13 Jun 2024 11:30:51 +0300
> From: Andrea Corallo <acorallo <at> gnu.org>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  Björn Lindström
>  <bkhl <at> elektrubadur.se>,
>   71499 <at> debbugs.gnu.org
> Date: Thu, 13 Jun 2024 03:38:42 -0400
> 
> Stefan Kangas <stefankangas <at> gmail.com> writes:
> 
> > Eli Zaretskii <eliz <at> gnu.org> writes:
> >
> >>> I thought about that, but since whitespace-cleanup generally applies
> >>> clean-up according to white-space style, I thought it was simply an
> >>> oversight that it doesn't apply a fix when it is set to highlight
> >>> missing end-of-file newline.
> >>>
> >>> Adding a separate way to configure this removes the simplicity of
> >>> configuring your preferred whitespace-style as a single option.
> >>>
> >>> However, If you still disagree I can make another patch somehow
> >>> maintains the old behaviour as the default, so just let me know.
> >>
> >> Let's see what others think, and take it from there.
> >>
> >> Stefan, Andrea: WDYT about this change?
> >
> > AFAIU, the purpose of whitespace.el is to detect and eventually fix
> > incorrect whitespace, and it has two ways of doing this:
> >
> > - Visual highlighting
> > - Commands to fix problems (`whitespace-report` and
> >   `whitespace-cleanup).
> >
> > Since it is mostly configured in the centralized option,
> > `whitespace-style`, it seems natural that if a user wants to detect
> > `missing-newline-at-eof`, she would also want this to be fixed by
> > `whitespace-cleanup`.  This seems even more natural given that
> > `whitespace-report` already considers that a problem worthy of
> > reporting.  IOW, I tend to agree that this not already being the case
> > looks like an oversight.
> >
> > So I think the existing options are fine, and the patch could go in
> > as-is, despite the fact that it is backwards-incompatible.  If users
> > really hate it, I guess we will hear about it and can react.
> >
> > If we want to be really cautious, we might want to consider waiting with
> > this change until Emacs 31.  That should provide ample time for people
> > to notice the new behaviour and react.
> >
> > My two cents.
> 
> I'm as well for having the patch in, but I guess would be safer in 31 so
> we have plenty of time to react if needed.

OK, thanks.  I will then install after the branch is cut.

Meanwhile, Björn, I have a few comments to the patch:

  . it needs a NEWS entry announcing the new feature
  . is there any reason your code to handle the missing newline is not
    identical to what the implementation of require-final-newline
    does?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Fri, 14 Jun 2024 12:25:02 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Andrea Corallo <acorallo <at> gnu.org>, 71499 <at> debbugs.gnu.org,
 bkhl <at> elektrubadur.se, stefankangas <at> gmail.com
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Fri, 14 Jun 2024 14:23:17 +0200
>>>>> On Thu, 13 Jun 2024 11:30:51 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
    >> I'm as well for having the patch in, but I guess would be safer in 31 so
    >> we have plenty of time to react if needed.

    Eli> OK, thanks.  I will then install after the branch is cut.

    Eli> Meanwhile, Björn, I have a few comments to the patch:

    Eli>   . it needs a NEWS entry announcing the new feature
    Eli>   . is there any reason your code to handle the missing newline is not
    Eli>     identical to what the implementation of require-final-newline
    Eli>     does?

Iʼm going to chime in and say that, even though I highlight missing
newlines at eob, I donʼt normally set `require-final-newline' to t,
because of various reasons involving collaboration with others. So Iʼd
have to turn this off once it goes in.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Fri, 14 Jun 2024 12:54:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: acorallo <at> gnu.org, 71499 <at> debbugs.gnu.org, bkhl <at> elektrubadur.se,
 stefankangas <at> gmail.com
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Fri, 14 Jun 2024 15:50:43 +0300
> From: Robert Pluim <rpluim <at> gmail.com>
> Cc: Andrea Corallo <acorallo <at> gnu.org>,  71499 <at> debbugs.gnu.org,
>   stefankangas <at> gmail.com,  bkhl <at> elektrubadur.se
> Date: Fri, 14 Jun 2024 14:23:17 +0200
> 
> >>>>> On Thu, 13 Jun 2024 11:30:51 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
>     >> I'm as well for having the patch in, but I guess would be safer in 31 so
>     >> we have plenty of time to react if needed.
> 
>     Eli> OK, thanks.  I will then install after the branch is cut.
> 
>     Eli> Meanwhile, Björn, I have a few comments to the patch:
> 
>     Eli>   . it needs a NEWS entry announcing the new feature
>     Eli>   . is there any reason your code to handle the missing newline is not
>     Eli>     identical to what the implementation of require-final-newline
>     Eli>     does?
> 
> Iʼm going to chime in and say that, even though I highlight missing
> newlines at eob, I donʼt normally set `require-final-newline' to t,
> because of various reasons involving collaboration with others. So Iʼd
> have to turn this off once it goes in.

Maybe this feature should take a hint from require-final-newline?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Thu, 20 Jun 2024 07:57:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Robert Pluim <rpluim <at> gmail.com>
Cc: acorallo <at> gnu.org, 71499 <at> debbugs.gnu.org, bkhl <at> elektrubadur.se
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Thu, 20 Jun 2024 07:55:19 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Robert Pluim <rpluim <at> gmail.com>
>> Cc: Andrea Corallo <acorallo <at> gnu.org>,  71499 <at> debbugs.gnu.org,
>>   stefankangas <at> gmail.com,  bkhl <at> elektrubadur.se
>> Date: Fri, 14 Jun 2024 14:23:17 +0200
>>
>> >>>>> On Thu, 13 Jun 2024 11:30:51 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
>>     >> I'm as well for having the patch in, but I guess would be safer in 31 so
>>     >> we have plenty of time to react if needed.
>>
>>     Eli> OK, thanks.  I will then install after the branch is cut.
>>
>>     Eli> Meanwhile, Björn, I have a few comments to the patch:
>>
>>     Eli>   . it needs a NEWS entry announcing the new feature
>>     Eli>   . is there any reason your code to handle the missing newline is not
>>     Eli>     identical to what the implementation of require-final-newline
>>     Eli>     does?
>>
>> Iʼm going to chime in and say that, even though I highlight missing
>> newlines at eob, I donʼt normally set `require-final-newline' to t,
>> because of various reasons involving collaboration with others. So Iʼd
>> have to turn this off once it goes in.

Could you explain why you'd need to turn it off?

Do you usually use `whitespace-cleanup` on files where you collaborate
with others, but then you specifically don't want to ever touch newlines
at eob?

> Maybe this feature should take a hint from require-final-newline?

To my mind, the main use case of this feature would be users that don't
want to set `require-final-newline`, instead preferring to make such
fixes manually.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Thu, 20 Jun 2024 08:24:01 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, acorallo <at> gnu.org, 71499 <at> debbugs.gnu.org,
 bkhl <at> elektrubadur.se
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Thu, 20 Jun 2024 10:22:24 +0200
>>>>> On Thu, 20 Jun 2024 07:55:19 +0000, Stefan Kangas <stefankangas <at> gmail.com> said:

    Stefan> Eli Zaretskii <eliz <at> gnu.org> writes:
    >>> From: Robert Pluim <rpluim <at> gmail.com>
    >>> Cc: Andrea Corallo <acorallo <at> gnu.org>,  71499 <at> debbugs.gnu.org,
    >>> stefankangas <at> gmail.com,  bkhl <at> elektrubadur.se
    >>> Date: Fri, 14 Jun 2024 14:23:17 +0200
    >>> 
    >>> >>>>> On Thu, 13 Jun 2024 11:30:51 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
    >>> >> I'm as well for having the patch in, but I guess would be safer in 31 so
    >>> >> we have plenty of time to react if needed.
    >>> 
    Eli> OK, thanks.  I will then install after the branch is cut.
    >>> 
    Eli> Meanwhile, Björn, I have a few comments to the patch:
    >>> 
    Eli> . it needs a NEWS entry announcing the new feature
    Eli> . is there any reason your code to handle the missing newline is not
    Eli> identical to what the implementation of require-final-newline
    Eli> does?
    >>> 
    >>> Iʼm going to chime in and say that, even though I highlight missing
    >>> newlines at eob, I donʼt normally set `require-final-newline' to t,
    >>> because of various reasons involving collaboration with others. So Iʼd
    >>> have to turn this off once it goes in.

    Stefan> Could you explain why you'd need to turn it off?

    Stefan> Do you usually use `whitespace-cleanup` on files where you collaborate
    Stefan> with others, but then you specifically don't want to ever touch newlines
    Stefan> at eob?

Yes. I guess I could turn off whitespace-cleanup for those files, and
complain at those people more loudly :-) . I donʼt have a strong
objection to this feature, so we donʼt have to add
yet-another-config-variable just for me.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Thu, 20 Jun 2024 08:57:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, acorallo <at> gnu.org, 71499 <at> debbugs.gnu.org,
 bkhl <at> elektrubadur.se
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Thu, 20 Jun 2024 08:55:04 +0000
Robert Pluim <rpluim <at> gmail.com> writes:

> Yes. I guess I could turn off whitespace-cleanup for those files, and
> complain at those people more loudly :-) .

Just to confirm: you still want it highlighted, despite the fact that
you're anyways not planning to change it?  IOW, you couldn't just
customize `whitespace-style` in those directories and have it do what
you want?

Perhaps we should have `whitespace-disable-cleanups` for these use
cases, but it should then allow customizing a list of values similar to
the ones in `whitespace-style`.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Thu, 20 Jun 2024 09:47:02 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, acorallo <at> gnu.org, 71499 <at> debbugs.gnu.org,
 bkhl <at> elektrubadur.se
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Thu, 20 Jun 2024 11:45:45 +0200
>>>>> On Thu, 20 Jun 2024 08:55:04 +0000, Stefan Kangas <stefankangas <at> gmail.com> said:

    Stefan> Robert Pluim <rpluim <at> gmail.com> writes:
    >> Yes. I guess I could turn off whitespace-cleanup for those files, and
    >> complain at those people more loudly :-) .

    Stefan> Just to confirm: you still want it highlighted, despite the fact that
    Stefan> you're anyways not planning to change it?  IOW, you couldn't just
    Stefan> customize `whitespace-style` in those directories and have it do what
    Stefan> you want?

Thatʼs another way I could fix it, but itʼs fixable just in my config.

    Stefan> Perhaps we should have `whitespace-disable-cleanups` for these use
    Stefan> cases, but it should then allow customizing a list of values similar to
    Stefan> the ones in `whitespace-style`.

Again: letʼs not overcomplicate this just for my niche case.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Thu, 20 Jun 2024 11:25:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, acorallo <at> gnu.org, 71499 <at> debbugs.gnu.org,
 bkhl <at> elektrubadur.se
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Thu, 20 Jun 2024 04:23:28 -0700
Robert Pluim <rpluim <at> gmail.com> writes:

> Thatʼs another way I could fix it, but itʼs fixable just in my config.
[...]
> Again: letʼs not overcomplicate this just for my niche case.

Sounds good to me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Thu, 27 Jun 2024 07:38:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: bkhl <at> elektrubadur.se
Cc: acorallo <at> gnu.org, 71499 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Thu, 27 Jun 2024 10:37:24 +0300
> Cc: 71499 <at> debbugs.gnu.org, stefankangas <at> gmail.com, bkhl <at> elektrubadur.se
> Date: Thu, 13 Jun 2024 11:30:51 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> Meanwhile, Björn, I have a few comments to the patch:
> 
>   . it needs a NEWS entry announcing the new feature
>   . is there any reason your code to handle the missing newline is not
>     identical to what the implementation of require-final-newline
>     does?

Ping!  Björn, can you please post an updated patch with the above nits
taken care of?  We can install this now on the master branch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71499; Package emacs. (Sat, 29 Jun 2024 12:00:01 GMT) Full text and rfc822 format available.

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

From: Björn Lindström <bkhl <at> elektrubadur.se>
To: "Eli Zaretskii" <eliz <at> gnu.org>, 71499 <at> debbugs.gnu.org
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Sat, 29 Jun 2024 13:59:03 +0200
[Message part 1 (text/plain, inline)]
Hello,

updated patch attached, which ads a note to NEWS, and has a changed implementation of the insertion of missing newline inspired by the one from files.el. It's still slightly different to account for it also being possible to use on a region.

This time there's also an added test.

/ Björn

On Thu, Jun 27, 2024, at 09:37, Eli Zaretskii wrote:
>> Cc: 71499 <at> debbugs.gnu.org, stefankangas <at> gmail.com, bkhl <at> elektrubadur.se
>> Date: Thu, 13 Jun 2024 11:30:51 +0300
>> From: Eli Zaretskii <eliz <at> gnu.org>
>> 
>> Meanwhile, Björn, I have a few comments to the patch:
>> 
>>   . it needs a NEWS entry announcing the new feature
>>   . is there any reason your code to handle the missing newline is not
>>     identical to what the implementation of require-final-newline
>>     does?
>
> Ping!  Björn, can you please post an updated patch with the above nits
> taken care of?  We can install this now on the master branch.
[0001-Make-whitespace.el-cleanup-add-missing-final-newline.patch (text/x-patch, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 29 Jun 2024 13:06:01 GMT) Full text and rfc822 format available.

Notification sent to Björn Lindström <bkhl <at> elektrubadur.se>:
bug acknowledged by developer. (Sat, 29 Jun 2024 13:06:02 GMT) Full text and rfc822 format available.

Message #58 received at 71499-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Björn Lindström <bkhl <at> elektrubadur.se>
Cc: 71499-done <at> debbugs.gnu.org
Subject: Re: bug#71499: [PATCH] Make whitespace.el cleanup add missing final
 newline
Date: Sat, 29 Jun 2024 16:05:23 +0300
> Date: Sat, 29 Jun 2024 13:59:03 +0200
> From: Björn Lindström <bkhl <at> elektrubadur.se>
> 
> updated patch attached, which ads a note to NEWS, and has a changed implementation of the insertion of missing newline inspired by the one from files.el. It's still slightly different to account for it also being possible to use on a region.
> 
> This time there's also an added test.

Thanks, installed on the master branch, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 28 Jul 2024 11:24:21 GMT) Full text and rfc822 format available.

This bug report was last modified 203 days ago.

Previous Next


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