GNU bug report logs -
#78579
30.0.92; Global variant of delete-trailing-whitespace-mode
Previous Next
Reported by: Jake <jforst.mailman <at> gmail.com>
Date: Sat, 24 May 2025 13:50:01 UTC
Severity: normal
Found in version 30.0.92
Done: Jake <jforst.mailman <at> gmail.com>
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 78579 in the body.
You can then email your comments to 78579 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78579
; Package
emacs
.
(Sat, 24 May 2025 13:50:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jake <jforst.mailman <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 24 May 2025 13:50:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
`delete-trailing-whitespace-mode` was introduced in commit 8a19c249f81.
Should there also be a `global-delete-trailing-whitespace-mode`?
This would allow
(global-delete-trailing-whitespace-mode 1)
and turning it off in an individual buffer with
(delete-trailing-whitespace-mode -1)
Thanks
Jake
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78579
; Package
emacs
.
(Sat, 24 May 2025 15:15:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 78579 <at> debbugs.gnu.org (full text, mbox):
> `delete-trailing-whitespace-mode` was introduced in commit 8a19c249f81.
> Should there also be a `global-delete-trailing-whitespace-mode`?
> This would allow
> (global-delete-trailing-whitespace-mode 1)
> and turning it off in an individual buffer with
> (delete-trailing-whitespace-mode -1)
To define such a mode, we'll need to know when to enable it and when
not: I'd be surprised if adding `delete-trailing-whitespace` globally
to `before-save-hook` doesn't cause problems in various circumstances.
I don't have enough experience with that, so I'll let others decide if
and how to do it.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78579
; Package
emacs
.
(Sat, 24 May 2025 15:24:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 78579 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sat, May 24, 2025 at 11:15 AM Stefan Monnier via Bug reports for GNU
Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org> wrote:
> > `delete-trailing-whitespace-mode` was introduced in commit 8a19c249f81.
> > Should there also be a `global-delete-trailing-whitespace-mode`?
> > This would allow
> > (global-delete-trailing-whitespace-mode 1)
> > and turning it off in an individual buffer with
> > (delete-trailing-whitespace-mode -1)
>
> To define such a mode, we'll need to know when to enable it and when
> not: I'd be surprised if adding `delete-trailing-whitespace` globally
> to `before-save-hook` doesn't cause problems in various circumstances.
>
> I don't have enough experience with that, so I'll let others decide if
> and how to do it.
>
FWIW, this is how I manage that and even then I might enable it for
markdown mode:
(defun my/before-save-hook ()
"Delete trailing white space before saving a buffer, except
`markdown-mode'."
(unless (derived-mode-p 'markdown-mode)
(delete-trailing-whitespace)))
(add-hook 'before-save-hook #'my/before-save-hook)
I suppose an exclusion mode list or some other conditionals could be baked
into the mode.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78579
; Package
emacs
.
(Sat, 24 May 2025 15:51:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 78579 <at> debbugs.gnu.org (full text, mbox):
> Cc: 78579 <at> debbugs.gnu.org
> Date: Sat, 24 May 2025 11:14:24 -0400
> From: Stefan Monnier via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> > `delete-trailing-whitespace-mode` was introduced in commit 8a19c249f81.
> > Should there also be a `global-delete-trailing-whitespace-mode`?
> > This would allow
> > (global-delete-trailing-whitespace-mode 1)
> > and turning it off in an individual buffer with
> > (delete-trailing-whitespace-mode -1)
>
> To define such a mode, we'll need to know when to enable it and when
> not: I'd be surprised if adding `delete-trailing-whitespace` globally
> to `before-save-hook` doesn't cause problems in various circumstances.
>
> I don't have enough experience with that, so I'll let others decide if
> and how to do it.
I share the fears expressed by Stefan. I think that such a global
mode would be more dangerous than it's useful. After all, it's easy
to add the activation of the local minor mode to mode-hook of any
modes one wants.
Reply sent
to
Jake <jforst.mailman <at> gmail.com>
:
You have taken responsibility.
(Sun, 25 May 2025 10:08:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jake <jforst.mailman <at> gmail.com>
:
bug acknowledged by developer.
(Sun, 25 May 2025 10:08:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 78579-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thanks for explaining. Closing
On Sun, 25 May 2025 at 1:20 am, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Cc: 78579 <at> debbugs.gnu.org
> > Date: Sat, 24 May 2025 11:14:24 -0400
> > From: Stefan Monnier via "Bug reports for GNU Emacs,
> > the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >
> > > `delete-trailing-whitespace-mode` was introduced in commit 8a19c249f81.
> > > Should there also be a `global-delete-trailing-whitespace-mode`?
> > > This would allow
> > > (global-delete-trailing-whitespace-mode 1)
> > > and turning it off in an individual buffer with
> > > (delete-trailing-whitespace-mode -1)
> >
> > To define such a mode, we'll need to know when to enable it and when
> > not: I'd be surprised if adding `delete-trailing-whitespace` globally
> > to `before-save-hook` doesn't cause problems in various circumstances.
> >
> > I don't have enough experience with that, so I'll let others decide if
> > and how to do it.
>
> I share the fears expressed by Stefan. I think that such a global
> mode would be more dangerous than it's useful. After all, it's easy
> to add the activation of the local minor mode to mode-hook of any
> modes one wants.
>
[Message part 2 (text/html, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 22 Jun 2025 11:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.