From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#41779: Fall back between vc-diff and diff-backup Date: Thu, 25 Jun 2020 02:32:32 +0300 Organization: LINKOV.NET Message-ID: <87y2ocavlb.fsf@mail.linkov.net> References: <505E43E1.9090801@yandex.ru> <871rzer8t2.fsf@mail.linkov.net> <8d51a8c9-6200-84c9-cadb-09576b060fe1@yandex.ru> <87o92h7fv1.fsf@mail.linkov.net> <878stissii.fsf@mail.linkov.net> <87muhtzh8z.fsf@mail.linkov.net> <4538945a-4a47-e8a2-7c3b-485f229c0a98@yandex.ru> <871rz4qpni.fsf@mail.linkov.net> <87v9wdzc3g.fsf@mail.linkov.net> <87mu5b24ob.fsf_-_@mail.linkov.net> <871rmmoadn.fsf@mail.linkov.net> <4d00562c-e042-2519-eb18-b2ef009da6e6@yandex.ru> <874krilde9.fsf@mail.linkov.net> <41eb53fd-3973-8812-a7f4-403e02e4164e@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="63217"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 41779@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 25 01:47:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joF6n-000GKX-Db for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Jun 2020 01:47:13 +0200 Original-Received: from localhost ([::1]:59130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joF6m-0003I7-EB for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Jun 2020 19:47:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joF6c-0003HQ-SQ for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2020 19:47:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56020) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1joF6c-0000v4-Je for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2020 19:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1joF6c-0005XR-Hu for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2020 19:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Jun 2020 23:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41779 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 41779-submit@debbugs.gnu.org id=B41779.159304241321245 (code B ref 41779); Wed, 24 Jun 2020 23:47:02 +0000 Original-Received: (at 41779) by debbugs.gnu.org; 24 Jun 2020 23:46:53 +0000 Original-Received: from localhost ([127.0.0.1]:39327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joF6T-0005WW-9B for submit@debbugs.gnu.org; Wed, 24 Jun 2020 19:46:53 -0400 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:33669) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joF6P-0005Vr-MO; Wed, 24 Jun 2020 19:46:49 -0400 X-Originating-IP: 91.129.108.6 Original-Received: from mail.gandi.net (m91-129-108-6.cust.tele2.ee [91.129.108.6]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 4EC0C1BF209; Wed, 24 Jun 2020 23:46:43 +0000 (UTC) In-Reply-To: <41eb53fd-3973-8812-a7f4-403e02e4164e@yandex.ru> (Dmitry Gutov's message of "Thu, 11 Jun 2020 02:26:05 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:182361 Archived-At: tags 41779 wontfix close 41779 28.0.50 quit >> But I don't insist on this feature, I can handle this in my init file. >> I proposed it as a patch only because Lars mentioned the same problem. > > I think my suggestion is not significantly worse or more awkward to use. It seems my request was too specific, so I retract it. It's easy to achieve this fallback in the init file with: (advice-add 'diff-backup :around (lambda (orig-fun file &optional switches) (condition-case err (funcall orig-fun file switches) (error ;; Fall back to vc-diff (if (vc-backend file) (let ((vc-diff-switches switches)) (require 'vc) (vc-diff-internal t (list (vc-backend file) (list file)) nil nil t)) (error (cadr err)))))) '((name . diff-backup-fallback-to-vc-diff))) (advice-add 'vc-diff :around (lambda (orig-fun &rest args) (if (vc-deduce-backend) (apply orig-fun args) ;; Fall back to non-vc diff-backup (diff-backup (if (derived-mode-p 'dired-mode) (dired-get-filename) buffer-file-name) vc-diff-switches))) '((name . vc-diff-fallback-to-diff-backup)))