emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diff-mode misinterprets empty lines.


From: David Kastrup
Subject: Re: diff-mode misinterprets empty lines.
Date: Wed, 05 Dec 2007 19:12:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

> David Kastrup <address@hidden> writes:
>
>>> Too many tools these days can automatically remove trailing blanks.
>>
>> Why would you apply them to a _diff_?
>
> We're beating a dead horse here, since the default behavior has been
> changed back, but since you're interested in doing an autopsy....
>
> I regularly apply many tools to a diff.  I use Emacs, and other text
> editors.  I send diffs via email, and I store them as part of other
> text files.  The most recent email I sent to this forum contained a
> diff, for example.
>
> In environments that use diffs a lot, trailing white space can cause
> problems.

No.  In environments that use diffs, trailing white space needs to be
preserved.  Otherwise you could, for example, never have a diff that
removes trailing white space.

What _you_ mean is that in environments that _don't_ use diffs but
rather interpret them as naked text, inconveniences might occur.  But
those will occur with any patch dealing with trailing white space in any
manner, anyhow.

> Here's one example.  Emacs has a way of highlighting trailing white
> space.  This feature is a nice thing to have in general, since it
> highlights white space that in some applications can cause harm (C
> source code, makefiles, etc.) and that the user normally cannot see.
> But if 'diff' output contains unnecessary trailing white space, the
> highlighted white space turns into false alarms on your screen.

Which only means that it is is wrong to interpret diff output with an
unmodified trailing whitespace detection mode.  Because diff files are
not merely text.  They carry a meaning.

> So that is at least one good motivation for suppressing unnecessary
> trailing white space.

The trailing white space is not unnecessary since it is part of the
format.

> I'm not saying that it is always the right thing to suppress trailing
> blanks; I'm only saying that there are good reasons to do so in some
> cases.

diff-mode clearly is not such a one.

> By the way, the diff that I sent in my previous email
> <http://lists.gnu.org/archive/html/bug-gnu-utils/2007-12/msg00026.html>
> suppressed the trailing white space in question.  Did you notice?

I happen not to be a program.  If I had used Emacs for actually dealing
with the diff, I would have noticed.

Isn't it quite nonsensical to ask this question?  Would you be bothering
messing with trailing whitespace in the first place if it was
human-visible normally?

> I've used this format for many months now, for patches that I send via
> email.  No problems have been reported with these patches.

You mean, the mailing list thread on the Emacs developer list (which the
request to change this back originated on) is just a figment of my
imagination?  No problem report triggered it?

> And I send out my fair share of patches.

The "patch" program deals with this format violation.  Not everything
else does, and people often repair patches instead of reporting them.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

[Prev in Thread] Current Thread [Next in Thread]