GNU bug report logs -
#12831
24.2.50; diff-remove-trailing-whitespace is broken
Previous Next
Reported by: Chong Yidong <cyd <at> gnu.org>
Date: Thu, 8 Nov 2012 10:34:01 UTC
Severity: normal
Found in version 24.2.50
Done: Chong Yidong <cyd <at> gnu.org>
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 12831 in the body.
You can then email your comments to 12831 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
ofv <at> wanadoo.es, bug-gnu-emacs <at> gnu.org
:
bug#12831
; Package
emacs
.
(Thu, 08 Nov 2012 10:34:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Chong Yidong <cyd <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
ofv <at> wanadoo.es, bug-gnu-emacs <at> gnu.org
.
(Thu, 08 Nov 2012 10:34:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The command diff-remove-trailing-whitespace, newly introduced for Emacs
24.3, is broken. AFAICT, it can't easily be made to work right.
1) diff-remove-trailing-whitespace is confused about the order of files
in the diff:
echo "a" > oldfile
echo "b " > newfile
emacs -Q
M-x diff RET newfile RET oldfile RET
C-x o
M-x diff-remove-trailing-whitespace RET
=> no trailing whitespace fixes needed
(Note that the new file is by convention the FIRST argument to M-x
diff and the SECOND argument to the `diff' command.) This can be
fixed by replacing (diff-find-source-location t t) in the definition
of diff-remove-trailing-whitespace. But we hit the second problem:
2) After the trailing whitespaces are fixed in the underlying files, the
trailing whitespace still remains in the *Diff* buffer. The basic
problem is that the algorithm of this command is too simplistic: it
looks for trailing whitespace in the Diff buffer, jumps to the
corresponding location given by diff-find-source-location, looks for
trailing whitespace on that line, and deletes it.
This simple algorithm can lead to serious mistakes. There's no
attempt to check if the point in the Diff buffer corresponds to a
"before" or "after" line (nothing ought to be done for the former,
but the existing command is happy to use it), or whether the
"trailing whitespace" that it found is merely the space which is
customarily inserted after "!" in context diffs.
Unless someone comes up with a version of this command that works right,
I think we should go back to the drawing board on this, and remove it
from Emacs 24.3.
Reply sent
to
Chong Yidong <cyd <at> gnu.org>
:
You have taken responsibility.
(Thu, 08 Nov 2012 17:34:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Chong Yidong <cyd <at> gnu.org>
:
bug acknowledged by developer.
(Thu, 08 Nov 2012 17:34:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 12831-done <at> debbugs.gnu.org (full text, mbox):
> The command diff-remove-trailing-whitespace, newly introduced for Emacs
> 24.3, is broken.
I have rewritten the command to make it work properly, and renamed it to
diff-delete-trailing-whitespace (for consistency with the existing
delete-trailing-whitespace command).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 07 Dec 2012 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 151 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.