GNU bug report logs - #11067
diff-no-select assumes diff-command understands -L option

Previous Next

Package: emacs;

Reported by: Arni Magnusson <arnima <at> hafro.is>

Date: Thu, 22 Mar 2012 15:26:01 UTC

Severity: normal

Found in version 24.0.94.1

Fixed in version 24.4

Done: Glenn Morris <rgm <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 11067 in the body.
You can then email your comments to 11067 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Thu, 22 Mar 2012 15:26:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arni Magnusson <arnima <at> hafro.is>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 22 Mar 2012 15:26:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arni Magnusson <arnima <at> hafro.is>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.94.1; diff-buffer-with-file
Date: Thu, 22 Mar 2012 14:54:16 +0000 (UTC)
I'm running Emacs 24.0.94.1 alpha,

http://alpha.gnu.org/gnu/emacs/windows/emacs-20120319-r107630-bin-i386.zip

and `diff-buffer-with-file' is not working like it did in Emacs 23.4.1

1. Start emacs -Q
2. Set `diff-command' to "winmerge" and `diff-switches' to nil
3. Open a file, say c:/gnu/emacs/BUGS, make some changes without saving
4. M-x diff-buffer-with-file

Emacs 23.4.1 performs this task very nicely, but Emacs 24.0.94.1 alpha 
provides the external program with args that cannot be compared:

  c:\gnu\emacs\-L
  c:\gnu\emacs\BUGS

Examining the Emacs *Diff* buffer provides some insights. In Emacs 23.4.1 
it contains

  winmerge "c:/gnu/emacs/BUGS" "c:/Temp/buffer-content-3436L7C"

which looks sensible, but in Emacs 24.0.94.1 alpha it the *Diff* buffer 
contains

  winmerge "-L" "c:/gnu/emacs/BUGS" "-L" "#<buffer BUGS>" 
"c:/gnu/emacs/BUGS" "c:/Temp/buffer-content-2640boz"

which looks like 6 args instead of 2, including some "-L" options (even 
after specifically disabling all diff switches) and "#<buffer BUGS>" 
(probably of no use to an external program).

To me, it looks like version 24.0.94.1 of `diff-buffer-with-file' in 
diff.el should try harder to mimic the behavior of version 23.4.1 in 
files.el.

Many thanks,

Arni




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Fri, 23 Mar 2012 22:06:01 GMT) Full text and rfc822 format available.

Message #8 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 11067 <at> debbugs.gnu.org
Cc: Arni Magnusson <arnima <at> hafro.is>
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Fri, 23 Mar 2012 17:34:04 -0400
Arni Magnusson wrote:

> in Emacs 24.0.94.1 alpha it the *Diff* buffer contains
>
>   winmerge "-L" "c:/gnu/emacs/BUGS" "-L" "#<buffer BUGS>"
> "c:/gnu/emacs/BUGS" "c:/Temp/buffer-content-2640boz"

Semi-related:

I was wondering why I could not find "-L" in diff's help output or
man-page, then I found:

http://savannah.nongnu.org/bugs/?35267

    Currently CVS uses GNU diff's -L option. That option has been
    undocumented since diffutils 2.8 (released in March 2002) and the
    option is intended to be replaced sometime soon with a different
    meaning.

    Can you please fix CVS so that it uses "diff --label" instead of
    "diff -L"? That will make CVS immune to this planned change.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Fri, 23 Mar 2012 22:11:02 GMT) Full text and rfc822 format available.

Message #11 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 11067 <at> debbugs.gnu.org
Cc: Arni Magnusson <arnima <at> hafro.is>
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Fri, 23 Mar 2012 17:39:15 -0400
Also, on "Solaris 10 5/08", /bin/diff does not understand -L (or --label).




Changed bug title to 'diff-no-select assumes diff-command understands -L option' from '24.0.94.1; diff-buffer-with-file' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 23 Mar 2012 22:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sat, 24 Mar 2012 02:22:02 GMT) Full text and rfc822 format available.

Message #16 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Arni Magnusson <arnima <at> hafro.is>, 11067 <at> debbugs.gnu.org
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Fri, 23 Mar 2012 21:49:50 -0400
>> in Emacs 24.0.94.1 alpha it the *Diff* buffer contains
>> 
>> winmerge "-L" "c:/gnu/emacs/BUGS" "-L" "#<buffer BUGS>"
>> "c:/gnu/emacs/BUGS" "c:/Temp/buffer-content-2640boz"

> Semi-related:

> I was wondering why I could not find "-L" in diff's help output or
> man-page, then I found:

> http://savannah.nongnu.org/bugs/?35267

>     Currently CVS uses GNU diff's -L option. That option has been
>     undocumented since diffutils 2.8 (released in March 2002) and the
>     option is intended to be replaced sometime soon with a different
>     meaning.

>     Can you please fix CVS so that it uses "diff --label" instead of
>     "diff -L"? That will make CVS immune to this planned change.

Hmm... interesting.  I found the -L in Debian's Info page and it's still
there in Debian's "diffutils-1:3.2-2".  So either it's a local addition
done by Debian, or the -L is actually documented.

...hmmm... well line 3828 of
http://git.savannah.gnu.org/cgit/diffutils.git/tree/doc/diffutils.texi
shows that it's documented in diffutils.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sat, 24 Mar 2012 02:25:01 GMT) Full text and rfc822 format available.

Message #19 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Arni Magnusson <arnima <at> hafro.is>
Cc: 11067 <at> debbugs.gnu.org
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Fri, 23 Mar 2012 21:53:57 -0400
> http://alpha.gnu.org/gnu/emacs/windows/emacs-20120319-r107630-bin-i386.zip
> and `diff-buffer-with-file' is not working like it did in Emacs 23.4.1
> 1. Start emacs -Q
> 2. Set `diff-command' to "winmerge" and `diff-switches' to nil

It seems that's your problem: winmerge is not a replacement for `diff'
because it does not accept the "-L <label>" argument of diff.

Any particular reason to use winmerge rather than diff?  Does it let you
view the diff in winmerge, or does it return a diff-style output in *diff*?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sat, 24 Mar 2012 03:01:01 GMT) Full text and rfc822 format available.

Message #22 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Arni Magnusson <arnima <at> hafro.is>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11067 <at> debbugs.gnu.org
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Sat, 24 Mar 2012 02:28:32 +0000 (UTC)
Hi Stefan, thanks for the response.

Being able to set `diff-command' to any external program is a great 
feature in Emacs, in my experience. I have been using it for many Emacs 
versions, and I would miss this capability if it would be removed from 
Emacs 24.

In Windows I set `diff-command' to "winmerge" and in Linux I set it to 
"kompare". Next week I might set it to whatever I find the most efficient 
diff program for me.

This lets me view the differences in a feature-rich external diff program. 
I can visualize the differences between my modified buffer and saved state 
much more efficiently than with diff. Sure, diff is okay for visualizing 
the changes, ediff would be better, but really the external diff programs 
are much more efficient for me. My `ediff-mode-hook' is extensive, but I 
still find the external programs more efficient.

I understand that pure diff is, well, pure. But I remember how impressed 
and thankful I was when I disovered the flexibility of `diff-command', and 
I'm guessing many other Emacs users have found it practical to set it to 
something other than "diff". Comparing changes is an important task when 
editing, and it's great that Emacs can delegate this task to specialized 
programs, although the default is to handle things within Emacs.

Best regards,

Arni



On Fri, 23 Mar 2012, Stefan Monnier wrote:

>> http://alpha.gnu.org/gnu/emacs/windows/emacs-20120319-r107630-bin-i386.zip
>> and `diff-buffer-with-file' is not working like it did in Emacs 23.4.1
>> 1. Start emacs -Q
>> 2. Set `diff-command' to "winmerge" and `diff-switches' to nil
>
> It seems that's your problem: winmerge is not a replacement for `diff'
> because it does not accept the "-L <label>" argument of diff.
>
> Any particular reason to use winmerge rather than diff?  Does it let you
> view the diff in winmerge, or does it return a diff-style output in *diff*?
>
>
>        Stefan
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sat, 24 Mar 2012 06:46:01 GMT) Full text and rfc822 format available.

Message #25 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: arnima <at> hafro.is, 11067 <at> debbugs.gnu.org
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Sat, 24 Mar 2012 08:13:56 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Date: Fri, 23 Mar 2012 21:53:57 -0400
> Cc: 11067 <at> debbugs.gnu.org
> 
> > http://alpha.gnu.org/gnu/emacs/windows/emacs-20120319-r107630-bin-i386.zip
> > and `diff-buffer-with-file' is not working like it did in Emacs 23.4.1
> > 1. Start emacs -Q
> > 2. Set `diff-command' to "winmerge" and `diff-switches' to nil
> 
> It seems that's your problem: winmerge is not a replacement for `diff'
> because it does not accept the "-L <label>" argument of diff.

Actually, winmerge _is_ a valid replacement, because it includes GNU
Diff as its part.  It's just that it doesn't know about -L, and
rightfully so, since that switch is undocumented in many versions of
Diff.

Regardless, I think it's obnoxious on the part of Emacs to stick
literal switches into a command without either (a) probing that the
command does indeed accept them, or (b) giving the user an opportunity
to customize these switches.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sat, 24 Mar 2012 06:47:01 GMT) Full text and rfc822 format available.

Message #28 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: rgm <at> gnu.org, 11067 <at> debbugs.gnu.org, arnima <at> hafro.is
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Sat, 24 Mar 2012 08:15:41 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Date: Fri, 23 Mar 2012 21:49:50 -0400
> Cc: Arni Magnusson <arnima <at> hafro.is>, 11067 <at> debbugs.gnu.org
> 
> ...hmmm... well line 3828 of
> http://git.savannah.gnu.org/cgit/diffutils.git/tree/doc/diffutils.texi
> shows that it's documented in diffutils.

So now we are going to require GNU Diffutils as a prerequisite for
using these Emacs commands?  Somehow, that doesn't sound right to me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sat, 24 Mar 2012 18:52:01 GMT) Full text and rfc822 format available.

Message #31 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Arni Magnusson <arnima <at> hafro.is>
Cc: 11067 <at> debbugs.gnu.org
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Sat, 24 Mar 2012 14:19:26 -0400
> 2. Set `diff-command' to "winmerge" and `diff-switches' to nil

I think I'm beginning to understand the problem a bit better.
I.e. the immediate problem for you is the fact that the new code uses
"-L <label>", but in reality, even in Emacs-23 there were problems with
your approach: your diff-command does not behave as expected, which
breaks some code that uses diff-command internally (I'd guess that
smerge-resolve and diff-refine-hunk are affected, for example), and you
may end up with a "spurious" *diff* buffer displayed even though you
don't actually want/need it since you'll view the diff in the winmerge
window instead.

So I think that putting winmerge into diff-command is working at too-low
a level (tho it's the only level available to you right now).  We'd want
instead to provide a new custom variable to let you choose your favorite
diff'ing tool, which can be a command like winmerge/kcompare/xxdiff, or
it could be diff+diff-mode (the current default behavior), or it could
be ediff.

For 24.1, we could provide a `diff-command-understands-L' which you
could set to nil (and which smerge-mode could also obey).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sat, 24 Mar 2012 18:59:02 GMT) Full text and rfc822 format available.

Message #34 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Arni Magnusson <arnima <at> hafro.is>, Paul Eggert <eggert <at> cs.ucla.edu>,
	11067 <at> debbugs.gnu.org
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Sat, 24 Mar 2012 14:27:03 -0400
Stefan Monnier wrote:

> Hmm... interesting.  I found the -L in Debian's Info page and it's still
> there in Debian's "diffutils-1:3.2-2".  So either it's a local addition
> done by Debian, or the -L is actually documented.

diffutils seem to be going backwards and forwards on this one, eg

http://lists.gnu.org/archive/html/bug-diffutils/2012-01/msg00009.html

Paul can probably tell us the current thinking...


Anyway, what about Solaris's diff, which has neither -L nor --label?

Why not test for this option, which Emacs presumably uses only for
cosmetic effect, before using it?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sat, 24 Mar 2012 21:44:02 GMT) Full text and rfc822 format available.

Message #37 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Arni Magnusson <arnima <at> hafro.is>, 11067 <at> debbugs.gnu.org,
	Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Sat, 24 Mar 2012 14:12:05 -0700
On 03/24/2012 11:27 AM, Glenn Morris wrote:
> Paul can probably tell us the current thinking...
Our current thinking is that "diff -L" is undocumented
and that applications should use "diff --label" instead
as -L's behavior may change in the future.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11067; Package emacs. (Sun, 25 Mar 2012 03:55:01 GMT) Full text and rfc822 format available.

Message #40 received at 11067 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Glenn Morris <rgm <at> gnu.org>, 11067 <at> debbugs.gnu.org,
	Arni Magnusson <arnima <at> hafro.is>
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Sat, 24 Mar 2012 23:23:20 -0400
>> Paul can probably tell us the current thinking...
> Our current thinking is that "diff -L" is undocumented

Then it urgently needs to fix its texinfo file.


        Setfan




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Mon, 11 Feb 2013 08:30:03 GMT) Full text and rfc822 format available.

Notification sent to Arni Magnusson <arnima <at> hafro.is>:
bug acknowledged by developer. (Mon, 11 Feb 2013 08:30:03 GMT) Full text and rfc822 format available.

Message #45 received at 11067-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 11067-done <at> debbugs.gnu.org
Subject: Re: bug#11067: 24.0.94.1; diff-buffer-with-file
Date: Mon, 11 Feb 2013 03:29:10 -0500
Version: 24.4

Fixed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 11 Mar 2013 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 69 days ago.

Previous Next


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