From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#18824: split diff-check-labels off diff-no-select Date: Sat, 25 Oct 2014 09:17:49 +0000 Message-ID: <87h9ysecea.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1414228762 28607 80.91.229.3 (25 Oct 2014 09:19:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Oct 2014 09:19:22 +0000 (UTC) To: 18824@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 25 11:19:17 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XhxVE-0006Yt-DG for geb-bug-gnu-emacs@m.gmane.org; Sat, 25 Oct 2014 11:19:16 +0200 Original-Received: from localhost ([::1]:52724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhxVD-0003Iw-Tq for geb-bug-gnu-emacs@m.gmane.org; Sat, 25 Oct 2014 05:19:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhxV6-0003In-A7 for bug-gnu-emacs@gnu.org; Sat, 25 Oct 2014 05:19:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XhxV1-000521-MK for bug-gnu-emacs@gnu.org; Sat, 25 Oct 2014 05:19:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhxV0-00051x-U4 for bug-gnu-emacs@gnu.org; Sat, 25 Oct 2014 05:19:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XhxV0-0006p2-DY for bug-gnu-emacs@gnu.org; Sat, 25 Oct 2014 05:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Oct 2014 09:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: submit@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.141422868326127 (code B ref -1); Sat, 25 Oct 2014 09:19:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Oct 2014 09:18:03 +0000 Original-Received: from localhost ([127.0.0.1]:34562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XhxU2-0006nE-Ne for submit@debbugs.gnu.org; Sat, 25 Oct 2014 05:18:03 -0400 Original-Received: from fely.am-1.org ([78.47.74.50]:37397) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XhxU0-0006mn-5I for submit@debbugs.gnu.org; Sat, 25 Oct 2014 05:18:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=ydho5s646twS/jkLVnKoQ8/OqZRa4IrhJOiTI8Pdv/Y=; b=WLc2zwJUndLnOBcqHOEFMil38Mhg2UgKbZtnyiYDcR3pNfYD0qreWjJTcAlS9jPuZ7BFM3IIY148URUsu54DJ8s8+xMjlehX7keHYcWusVCefr63vKpEB2g3nXXku4h0sKv376ngnVWCGxELn8OfN+bP/I0kRDuDFF6rpJ75/H0=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XhxTy-0007AN-9f for submit@debbugs.gnu.org; Sat, 25 Oct 2014 09:17:58 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XhxTp-0007Ws-RX for submit@debbugs.gnu.org; Sat, 25 Oct 2014 16:17:49 +0700 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95063 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs Severity: wishlist Tags: patch Please provide a separate diff-check-labels function to allow for the code calling diff.el facilities to supply its own --label=3D arguments to diff in place of diff.el-generated ones. Possible patch, as well as the example usage, are MIMEd. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -121,6 +121,15 @@ Possible values are: nil -- no, it does not check -- try to probe whether it does") +(defun diff-check-labels (&optional force) + (if (not (or force (eq 'check diff-use-labels))) + diff-use-labels + (setq diff-use-labels + (with-temp-buffer + (when (ignore-errors + (call-process diff-command nil t nil "--help")) + (if (search-backward "--label" nil t) t)))))) + (defun diff-no-select (old new &optional switches no-async buf) ;; Noninteractive helper for creating and reverting diff buffers (unless (bufferp new) (setq new (expand-file-name new))) @@ -128,11 +137,7 @@ diff-no-select (old new &optional switches no-async buf) (or switches (setq switches diff-switches)) ; If not specified, use default. (unless (listp switches) (setq switches (list switches))) (or buf (setq buf (get-buffer-create "*Diff*"))) - (when (eq 'check diff-use-labels) - (setq diff-use-labels - (with-temp-buffer - (when (ignore-errors (call-process diff-command nil t nil "--help")) - (if (search-backward "--label" nil t) t))))) + (diff-check-labels) (let* ((old-alt (diff-file-local-copy old)) (new-alt (diff-file-local-copy new)) (command --=-=-= Content-Type: text/emacs-lisp Content-Disposition: inline (let ((old "old") (new "new") (target (get-buffer-create "*My Diff*")) (labels (and (diff-check-labels) (mapcar 'shell-quote-argument (list "--label" "*old revision*" "--label" "*new revision*"))))) (if labels (let ((diff-use-labels nil) (sw (nconc labels (if (listp diff-switches) diff-switches (list diff-switches))))) (diff-no-select old new switches nil target)) (diff-no-select old new nil nil target))) --=-=-=--