GNU bug report logs - #78264
[PATCH] simple.el (delete-trailing-whitespace-mode): New minor mode

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Mon, 5 May 2025 16:03:02 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 78264 in the body.
You can then email your comments to 78264 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 monnier <at> iro.umontreal.ca, editorconfig <at> googlegroups.com, bug-gnu-emacs <at> gnu.org:
bug#78264; Package emacs. (Mon, 05 May 2025 16:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, editorconfig <at> googlegroups.com, bug-gnu-emacs <at> gnu.org. (Mon, 05 May 2025 16:03:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] simple.el (delete-trailing-whitespace-mode): New minor mode
Date: Mon, 05 May 2025 12:01:22 -0400
[Message part 1 (text/plain, inline)]
Tags: patch

While

    (add-hook 'before-save-hook #'delete-trailing-whitespace nil t)

is simple enough to put into one's init file, it's a bit rough around
the edges (e.g. for read-only buffers, or interaction with
editorconfig).  So I suggest we add a simple
`delete-trailing-whitespace-mode` minor mode.

Comments?  Objections?


        Stefan


 In GNU Emacs 31.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.24.49,
 cairo version 1.18.4) of 2025-05-01 built on alfajor
Repository revision: 3555aa795435c6c150e9291386cb776acd35e564
Repository branch: work
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type --with-modules --with-cairo --with-tiff=ifavailable
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'

[0001-simple.el-delete-trailing-whitespace-mode-New-minor-.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78264; Package emacs. (Sat, 10 May 2025 08:46:02 GMT) Full text and rfc822 format available.

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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: 78264 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
 EditorConfig Team <editorconfig <at> googlegroups.com>
Subject: Re: bug#78264: [PATCH] simple.el (delete-trailing-whitespace-mode):
 New minor mode
Date: Sat, 10 May 2025 09:45:05 +0100
Hello,

Seems reasonable, though can we make sure Emacs will let you enable it
from .dir-locals.el for a repository without generating warnings?
I.e. set whatever is needed to trust it as a minor mode enabled from
there (which may be nothing).

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78264; Package emacs. (Sat, 10 May 2025 09:11:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 78264 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca,
 editorconfig <at> googlegroups.com
Subject: Re: bug#78264: [PATCH] simple.el (delete-trailing-whitespace-mode):
 New minor mode
Date: Sat, 10 May 2025 12:10:31 +0300
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
>  EditorConfig Team <editorconfig <at> googlegroups.com>
> From: Sean Whitton <spwhitton <at> spwhitton.name>
> Date: Sat, 10 May 2025 09:45:05 +0100
> 
> Seems reasonable, though can we make sure Emacs will let you enable it
> from .dir-locals.el for a repository without generating warnings?
> I.e. set whatever is needed to trust it as a minor mode enabled from
> there (which may be nothing).

Is this really useful to turn on for _every_ file in a directory?
What about files where trailing whitespace is significant (patches,
for example)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78264; Package emacs. (Sat, 10 May 2025 09:44:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 78264 <at> debbugs.gnu.org, EditorConfig Team <editorconfig <at> googlegroups.com>
Subject: Re: bug#78264: [PATCH] simple.el (delete-trailing-whitespace-mode):
 New minor mode
Date: Sat, 10 May 2025 05:42:57 -0400
> Seems reasonable, though can we make sure Emacs will let you enable it
> from .dir-locals.el for a repository without generating warnings?
> I.e. set whatever is needed to trust it as a minor mode enabled from
> there (which may be nothing).

AFAIK this is already the case for all minor modes.

I didn't check with `.dir-locals.el` but I did check with
`.editorconfig`, which should show the same behavior.



        Sefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78264; Package emacs. (Sat, 10 May 2025 11:01:02 GMT) Full text and rfc822 format available.

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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 78264 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca,
 editorconfig <at> googlegroups.com
Subject: Re: bug#78264: [PATCH] simple.el (delete-trailing-whitespace-mode):
 New minor mode
Date: Sat, 10 May 2025 11:59:59 +0100
Hello,

On Sat 10 May 2025 at 12:10pm +03, Eli Zaretskii wrote:

>> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
>>  EditorConfig Team <editorconfig <at> googlegroups.com>
>> From: Sean Whitton <spwhitton <at> spwhitton.name>
>> Date: Sat, 10 May 2025 09:45:05 +0100
>>
>> Seems reasonable, though can we make sure Emacs will let you enable it
>> from .dir-locals.el for a repository without generating warnings?
>> I.e. set whatever is needed to trust it as a minor mode enabled from
>> there (which may be nothing).
>
> Is this really useful to turn on for _every_ file in a directory?
> What about files where trailing whitespace is significant (patches,
> for example)?

True, it will probably be enabled by major mode, which .dir-locals.el
supports.

-- 
Sean Whitton




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Mon, 12 May 2025 16:42:02 GMT) Full text and rfc822 format available.

Notification sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
bug acknowledged by developer. (Mon, 12 May 2025 16:42:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 78264-done <at> debbugs.gnu.org
Subject: Re: bug#78264: [PATCH] simple.el (delete-trailing-whitespace-mode):
 New minor mode
Date: Mon, 12 May 2025 12:41:39 -0400
Pushed to `master`, closing,


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 10 Jun 2025 11:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified 3 days ago.

Previous Next


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