GNU bug report logs - #18783
24.4; fixup-whitespace at end of line leaves a trailing space

Previous Next

Package: emacs;

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 #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: nisse <at> lysator.liu.se (Niels Möller)
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4; fixup-whitespace at end of line leaves a trailing space
Date: Tue, 21 Oct 2014 11:59:11 +0200
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).

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.

Best regards,
/Niels Möller

--- simple.el	2014-08-22 17:52:28.000000000 +0200
+++ simple.el.patched	2014-10-21 11:38:59.000000000 +0200
@@ -787,7 +787,7 @@ Leave one space or none, according to th
   (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



-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.





This bug report was last modified 8 years and 107 days ago.

Previous Next


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