GNU bug report logs - #38575
27.0.50; Document that `diff' arguments OLD and NEW can be buffers

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Phil Sainty <psainty@HIDDEN>; dated Thu, 12 Dec 2019 06:47:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Dec 2019 07:44:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 12 02:44:24 2019
Received: from localhost ([127.0.0.1]:58987 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ifJ96-0003uh-Be
	for submit <at> debbugs.gnu.org; Thu, 12 Dec 2019 02:44:24 -0500
Received: from lists.gnu.org ([209.51.188.17]:36125)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <psainty@HIDDEN>) id 1ifJ93-0003uW-T1
 for submit <at> debbugs.gnu.org; Thu, 12 Dec 2019 02:44:22 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57155)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>) id 1ifJ92-0004t3-OM
 for bug-gnu-emacs@HIDDEN; Thu, 12 Dec 2019 02:44:21 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 RCVD_IN_DNSWL_LOW,URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <psainty@HIDDEN>) id 1ifJ91-0006lA-Hc
 for bug-gnu-emacs@HIDDEN; Thu, 12 Dec 2019 02:44:20 -0500
Received: from smtp-2.orcon.net.nz ([60.234.4.43]:34335)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <psainty@HIDDEN>)
 id 1ifJ91-0006gm-5q
 for bug-gnu-emacs@HIDDEN; Thu, 12 Dec 2019 02:44:19 -0500
Received: from [10.253.37.70] (port=44246 helo=webmail.orcon.net.nz)
 by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>) id 1ifJ8w-000052-6g
 for bug-gnu-emacs@HIDDEN; Thu, 12 Dec 2019 20:44:14 +1300
Received: from wlgwil-nat-office.catalyst.net.nz ([202.78.240.7])
 via [10.253.37.253] by webmail.orcon.net.nz
 with HTTP (HTTP/1.1 POST); Thu, 12 Dec 2019 20:44:15 +1300
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Thu, 12 Dec 2019 20:44:15 +1300
From: Phil Sainty <psainty@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Re: 27.0.50; Document that `diff' arguments OLD and NEW can be buffers
In-Reply-To: <d770eebbe9929e2842cd8592780440ad@HIDDEN>
References: <d770eebbe9929e2842cd8592780440ad@HIDDEN>
Message-ID: <5ce9330b0930c6a72c26fd08f66156d4@HIDDEN>
X-Sender: psainty@HIDDEN
User-Agent: Orcon Webmail
X-GeoIP: --
X-Spam_score: -2.9
X-Spam_score_int: -28
X-Spam_bar: --
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-Received-From: 60.234.4.43
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

This feature dates to the following commit, which I believe was
first released in 24.1.

Because this seems such a useful feature, I'm inclined to add a
NEWS entry as well, with the note "This change was made in Emacs
24.1, but wasn't documented until now."


-Phil



commit b2e4481906ec08e2c6072b6fe14dd1efca4784b9
Author: Stefan Monnier <monnier@HIDDEN>
Date:   Mon Nov 22 14:22:03 2010 -0500

     Cleanup diff-buffer-with-file.
     * lisp/vc/diff.el (diff-old-temp-file, diff-new-temp-file): Remove.
     (diff-sentinel): Get them as arguments instead.
     (diff-old-file, diff-new-file, diff-extra-args): Remove.
     (diff-file-local-copy, diff-better-file-name): New funs.
     (diff-no-select): Rename from diff-into-buffer.
     Support buffers additionally to files.  Move `buf' arg.  Don't 
display buf.
     Prefer closures to buffer-local variables.
     (diff): Adjust accordingly.
     (diff-buffer-with-file): Move from files.el.
     * lisp/files.el (diff-buffer-with-file): Move to vc/diff.el.
     (diff-buffer-internal): Remove.
     (diff-buffer-buffer): Remove.
     (save-some-buffers-action-alist): Use diff-no-select so as not to 
guess
     the buffer name used, and so as not to mess up windows and frames.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38575; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Dec 2019 06:46:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 12 01:46:51 2019
Received: from localhost ([127.0.0.1]:58957 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ifIFO-0001l7-OT
	for submit <at> debbugs.gnu.org; Thu, 12 Dec 2019 01:46:50 -0500
Received: from lists.gnu.org ([209.51.188.17]:33661)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <psainty@HIDDEN>) id 1ifIFM-0001l0-Uo
 for submit <at> debbugs.gnu.org; Thu, 12 Dec 2019 01:46:49 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:56530)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>) id 1ifIFL-0006A0-Ks
 for bug-gnu-emacs@HIDDEN; Thu, 12 Dec 2019 01:46:48 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: **
X-Spam-Status: No, score=2.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 RCVD_IN_DNSWL_LOW,SPOOFED_FREEMAIL autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <psainty@HIDDEN>) id 1ifIFK-0006Qw-Dc
 for bug-gnu-emacs@HIDDEN; Thu, 12 Dec 2019 01:46:47 -0500
Received: from smtp-2.orcon.net.nz ([60.234.4.43]:35065)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <psainty@HIDDEN>)
 id 1ifIFK-0006Lc-3K
 for bug-gnu-emacs@HIDDEN; Thu, 12 Dec 2019 01:46:46 -0500
Received: from [10.253.37.70] (port=43924 helo=webmail.orcon.net.nz)
 by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>) id 1ifIFD-000364-Pc
 for bug-gnu-emacs@HIDDEN; Thu, 12 Dec 2019 19:46:39 +1300
Received: from wlgwil-nat-office.catalyst.net.nz ([202.78.240.7])
 via [10.253.37.253] by webmail.orcon.net.nz
 with HTTP (HTTP/1.1 POST); Thu, 12 Dec 2019 19:46:40 +1300
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: 8bit
Date: Thu, 12 Dec 2019 19:46:40 +1300
From: Phil Sainty <psainty@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; Document that `diff' arguments OLD and NEW can be buffers
Message-ID: <d770eebbe9929e2842cd8592780440ad@HIDDEN>
X-Sender: psainty@HIDDEN
User-Agent: Orcon Webmail
X-GeoIP: --
X-Spam_score: -2.9
X-Spam_score_int: -28
X-Spam_bar: --
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-Received-From: 60.234.4.43
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

The docstring for `diff' is:

     (diff OLD NEW &optional SWITCHES NO-ASYNC)

     Find and display the differences between OLD and NEW files.
     When called interactively, read NEW, then OLD, using the
     minibuffer.  The default for NEW is the current buffer’s file
     name, and the default for OLD is a backup file for NEW, if one
     exists.  If NO-ASYNC is non-nil, call diff synchronously.

     When called interactively with a prefix argument, prompt
     interactively for diff switches.  Otherwise, the switches
     specified in the variable ‘diff-switches’ are passed to the
     diff command.


However either (or both) of OLD and NEW may alternatively be buffers,
with temporary files automatically created as necessary.  This happens
via `diff-file-local-copy' called by `diff-no-select'.

This feature is utilised by `diff-buffer-with-file', and is far too
useful to be undocumented by `diff'.

I suggest the following additional paragraph:

     Non-interactively, OLD and NEW may each be buffers, in which
     case a temporary file will be used.


If that wording is ok, I can commit the change.


-Phil





Acknowledgement sent to Phil Sainty <psainty@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#38575; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 12 Dec 2019 07:45:01 UTC

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