GNU bug report logs -
#18783
24.4; fixup-whitespace at end of line leaves a trailing space
Previous Next
Reported by: nisse <at> lysator.liu.se (Niels Möller)
Date: Tue, 21 Oct 2014 10:00:03 UTC
Severity: minor
Tags: fixed, patch
Found in version 24.4
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #8 received at 18783 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 18783 patch
quit
nisse <at> lysator.liu.se (Niels Möller) writes:
> The function fixup-whitespace leaves a trailing space when invoked at
> the end of a line (and this bug is a lot older than emacs-24.4).
Seems to have been present since the beginning, 1991-12-21 "Initial
revision" shows the same code.
> To reproduce: Run emacs -Q. Type x, to get a line containing "x" and
> with point at the end. Type M-x fixup-whitespace RET. A space is added,
> so we get a line containing "x ".
>
> I think this is a bug, because it's inconsistent with spacing
> conventions I'm aware of, and the space is deleted by emacs' M-x
> whitespace-cleanup.
>
> Patch below seems to solve the problem.
Looks good to me, I will push to master in a few days.
[0001-Stop-fixup-whitespace-adding-trailing-whitespace-Bug.patch (text/x-diff, inline)]
From afdf5b6f8bbea6863e82f3890cd7f750741f95b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse <at> lysator.liu.se>
Date: Tue, 21 Oct 2014 11:59:11 +0200
Subject: [PATCH] Stop `fixup-whitespace' adding trailing whitespace
(Bug#18783)
* lisp/simple.el (fixup-whitespace): Insert no spaces if point is at
end of line after deleting horizontal whitespace.
Copyright-paperwork-exempt: yes
---
lisp/simple.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/simple.el b/lisp/simple.el
index 7360e456e4..681cf83807 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -833,7 +833,7 @@ fixup-whitespace
(interactive "*")
(save-excursion
(delete-horizontal-space)
- (if (or (looking-at "^\\|\\s)")
+ (if (or (looking-at "^\\|$\\|\\s)")
(save-excursion (forward-char -1)
(looking-at "$\\|\\s(\\|\\s'")))
nil
--
2.11.1
This bug report was last modified 8 years and 106 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.