unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11067: 24.0.94.1; diff-buffer-with-file
@ 2012-03-22 14:54 Arni Magnusson
  2012-03-23 21:34 ` Glenn Morris
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Arni Magnusson @ 2012-03-22 14:54 UTC (permalink / raw)
  To: 11067

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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-22 14:54 bug#11067: 24.0.94.1; diff-buffer-with-file Arni Magnusson
@ 2012-03-23 21:34 ` Glenn Morris
  2012-03-23 21:39   ` Glenn Morris
  2012-03-24  1:49   ` Stefan Monnier
  2012-03-24  1:53 ` Stefan Monnier
  2012-03-24 18:19 ` Stefan Monnier
  2 siblings, 2 replies; 13+ messages in thread
From: Glenn Morris @ 2012-03-23 21:34 UTC (permalink / raw)
  To: 11067; +Cc: Arni Magnusson

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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-23 21:34 ` Glenn Morris
@ 2012-03-23 21:39   ` Glenn Morris
  2012-03-24  1:49   ` Stefan Monnier
  1 sibling, 0 replies; 13+ messages in thread
From: Glenn Morris @ 2012-03-23 21:39 UTC (permalink / raw)
  To: 11067; +Cc: Arni Magnusson


Also, on "Solaris 10 5/08", /bin/diff does not understand -L (or --label).





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-23 21:34 ` Glenn Morris
  2012-03-23 21:39   ` Glenn Morris
@ 2012-03-24  1:49   ` Stefan Monnier
  2012-03-24  6:15     ` Eli Zaretskii
  2012-03-24 18:27     ` Glenn Morris
  1 sibling, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2012-03-24  1:49 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Arni Magnusson, 11067

>> 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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-22 14:54 bug#11067: 24.0.94.1; diff-buffer-with-file Arni Magnusson
  2012-03-23 21:34 ` Glenn Morris
@ 2012-03-24  1:53 ` Stefan Monnier
  2012-03-24  2:28   ` Arni Magnusson
  2012-03-24  6:13   ` Eli Zaretskii
  2012-03-24 18:19 ` Stefan Monnier
  2 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2012-03-24  1:53 UTC (permalink / raw)
  To: Arni Magnusson; +Cc: 11067

> 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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-24  1:53 ` Stefan Monnier
@ 2012-03-24  2:28   ` Arni Magnusson
  2012-03-24  6:13   ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Arni Magnusson @ 2012-03-24  2:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 11067

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
>





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-24  1:53 ` Stefan Monnier
  2012-03-24  2:28   ` Arni Magnusson
@ 2012-03-24  6:13   ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2012-03-24  6:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: arnima, 11067

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 23 Mar 2012 21:53:57 -0400
> Cc: 11067@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-24  1:49   ` Stefan Monnier
@ 2012-03-24  6:15     ` Eli Zaretskii
  2012-03-24 18:27     ` Glenn Morris
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2012-03-24  6:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 11067, arnima

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 23 Mar 2012 21:49:50 -0400
> Cc: Arni Magnusson <arnima@hafro.is>, 11067@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-22 14:54 bug#11067: 24.0.94.1; diff-buffer-with-file Arni Magnusson
  2012-03-23 21:34 ` Glenn Morris
  2012-03-24  1:53 ` Stefan Monnier
@ 2012-03-24 18:19 ` Stefan Monnier
  2 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2012-03-24 18:19 UTC (permalink / raw)
  To: Arni Magnusson; +Cc: 11067

> 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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-24  1:49   ` Stefan Monnier
  2012-03-24  6:15     ` Eli Zaretskii
@ 2012-03-24 18:27     ` Glenn Morris
  2012-03-24 21:12       ` Paul Eggert
  1 sibling, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2012-03-24 18:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Arni Magnusson, Paul Eggert, 11067

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?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-24 18:27     ` Glenn Morris
@ 2012-03-24 21:12       ` Paul Eggert
  2012-03-25  3:23         ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Eggert @ 2012-03-24 21:12 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Arni Magnusson, 11067

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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-24 21:12       ` Paul Eggert
@ 2012-03-25  3:23         ` Stefan Monnier
  2013-02-11  8:29           ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2012-03-25  3:23 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 11067, Arni Magnusson

>> 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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#11067: 24.0.94.1; diff-buffer-with-file
  2012-03-25  3:23         ` Stefan Monnier
@ 2013-02-11  8:29           ` Glenn Morris
  0 siblings, 0 replies; 13+ messages in thread
From: Glenn Morris @ 2013-02-11  8:29 UTC (permalink / raw)
  To: 11067-done

Version: 24.4

Fixed.





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-02-11  8:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 14:54 bug#11067: 24.0.94.1; diff-buffer-with-file Arni Magnusson
2012-03-23 21:34 ` Glenn Morris
2012-03-23 21:39   ` Glenn Morris
2012-03-24  1:49   ` Stefan Monnier
2012-03-24  6:15     ` Eli Zaretskii
2012-03-24 18:27     ` Glenn Morris
2012-03-24 21:12       ` Paul Eggert
2012-03-25  3:23         ` Stefan Monnier
2013-02-11  8:29           ` Glenn Morris
2012-03-24  1:53 ` Stefan Monnier
2012-03-24  2:28   ` Arni Magnusson
2012-03-24  6:13   ` Eli Zaretskii
2012-03-24 18:19 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).