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.

Full log


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




This bug report was last modified 1 year and 22 days ago.

Previous Next


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