From unknown Fri Jun 20 07:12:08 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#41779 <41779@debbugs.gnu.org> To: bug#41779 <41779@debbugs.gnu.org> Subject: Status: Fall back between vc-diff and diff-backup Reply-To: bug#41779 <41779@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:12:08 +0000 retitle 41779 Fall back between vc-diff and diff-backup reassign 41779 emacs submitter 41779 Juri Linkov severity 41779 normal tag 41779 patch wontfix thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 09 19:39:56 2020 Received: (at submit) by debbugs.gnu.org; 9 Jun 2020 23:39:57 +0000 Received: from localhost ([127.0.0.1]:32977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jinqW-0007bt-M5 for submit@debbugs.gnu.org; Tue, 09 Jun 2020 19:39:56 -0400 Received: from lists.gnu.org ([209.51.188.17]:53208) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jinqV-0007bk-69 for submit@debbugs.gnu.org; Tue, 09 Jun 2020 19:39:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jinqU-0000Ms-UU for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 19:39:54 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:44721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jinqT-0001t7-GO for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 19:39:54 -0400 X-Originating-IP: 91.129.108.6 Received: from mail.gandi.net (m91-129-108-6.cust.tele2.ee [91.129.108.6]) (Authenticated sender: juri@linkov.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 4EAA9FF802 for ; Tue, 9 Jun 2020 23:39:48 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: Fall back between vc-diff and diff-backup References: <505E43E1.9090801@yandex.ru> <505E4A57.5020305@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> Date: Wed, 10 Jun 2020 02:35:48 +0300 In-Reply-To: <87v9wdzc3g.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 08 Jul 2019 01:56:11 +0300") Message-ID: <87mu5b24ob.fsf_-_@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.183.199; envelope-from=juri@linkov.net; helo=relay9-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/09 19:39:50 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Tags: patch >> Which reminds me -- why doesn't `C-x v =' work on normal files that have >> backups? I think that would be pretty nice, natural and useful... > > I have the same problem of sometimes typing `C-x v =' instead of `M-=' > (dired-backup-diff) on backuped files in dired, and vice versa - `M-=' > instead of `C-x v =' on VC files. Now this annoyance finally got me - using these keys throws an error most of the time: when files are not yet registered in vc I use `M-=', but after registering them in vc, I continue typing the same key `M-=' and get that annoying error. The situation with `C-x v =' is not better: often after forgetting that a file is not yet under vc control, typing `C-x v =' raises the same error. Therefore, this patch to the rescue: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-diff-backup.patch diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 9e7e771963..c94c442af8 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -230,10 +233,16 @@ diff-backup (if (backup-file-name-p file) (setq bak file ori (file-name-sans-versions file)) - (setq bak (or (diff-latest-backup-file file) - (error "No backup found for %s" file)) + (setq bak (diff-latest-backup-file file) ori file)) - (diff bak ori switches))) + (if bak + (diff bak ori switches) + ;; Fall back to vc-diff + (if (vc-backend file) + (let ((vc-diff-switches switches)) + (vc-diff-internal + t (list (vc-backend file) (list file)) nil nil t)) + (error "No backup found for %s" file))))) ;;;###autoload (defun diff-latest-backup-file (fn) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index c640ba0420..a0363bd774 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1888,11 +1890,15 @@ vc-diff The optional argument NOT-URGENT non-nil means it is ok to say no to saving the buffer." (interactive (list current-prefix-arg t)) - (if historic - (call-interactively 'vc-version-diff) - (when buffer-file-name (vc-buffer-sync not-urgent)) - (vc-diff-internal t (vc-deduce-fileset t) nil nil - (called-interactively-p 'interactive)))) + (if (vc-deduce-backend) + (if historic + (call-interactively 'vc-version-diff) + (when buffer-file-name (vc-buffer-sync not-urgent)) + (vc-diff-internal t (vc-deduce-fileset t) nil nil + (called-interactively-p 'interactive))) + ;; Fall back to non-vc diff-backup + (diff-backup (if (derived-mode-p 'dired-mode) (dired-get-filename) buffer-file-name) + vc-diff-switches))) ;;;###autoload (defun vc-diff-mergebase (_files rev1 rev2) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 15:05:46 2020 Received: (at 41779) by debbugs.gnu.org; 10 Jun 2020 19:05:46 +0000 Received: from localhost ([127.0.0.1]:35377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj62j-0000ir-Ph for submit@debbugs.gnu.org; Wed, 10 Jun 2020 15:05:45 -0400 Received: from mail-wr1-f44.google.com ([209.85.221.44]:42123) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj62i-0000iW-9y for 41779@debbugs.gnu.org; Wed, 10 Jun 2020 15:05:44 -0400 Received: by mail-wr1-f44.google.com with SMTP id p5so3524323wrw.9 for <41779@debbugs.gnu.org>; Wed, 10 Jun 2020 12:05:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=I4rK+ul/fBRn1dNUmPPisZ3Jf2ztiIfEE74PAx3+2z4=; b=tw6tjSbyCGBr2FWRlSdtRwke7LcIXIQMv+I18D/bii09Fvs9bLKS4y8KaKyjvdqJcw mF5B0xf6wtYx58/V7UUhbrqsXkmM33Zd0jcVcsC292ixp9LTBjfhq8QxB/R6mx0Xt0I4 NMpQKoLs+8fVVYtUfr8S4P6WwRki1ywhuBsLbqmSbEO7PfiSJZqve1gPMcocnulopSmS j/1hQMp12uG90hXqdR6ZXl9oSA3LGcZ0y7ID9O06U2UnLnHs2YwV69298nJ49wqOPQjo RTaHo1jnr04MniA8Xx1yRd8UXh85C/aeaDOGXWhZBx1AjJrQfWjQK/eW9ohvtOojOXXy 1lQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=I4rK+ul/fBRn1dNUmPPisZ3Jf2ztiIfEE74PAx3+2z4=; b=X0EXO5TVKnfXG+nGHMOxN7Ru3/gIfoHAc+duQWIa+MbPc55PavvkRFlFLsclndLDlh WSUL6PC6XeMlfNKPNR+tYILNenuFuu898Qv8TqdC0lsx5814+ODEEhC25YXFhQUabfFo MqynS4ylmD/r2mIqH7pxAjnOEUSDopAaA9dZizprioT//MH+8Ss1BPkHZfhPY16G1uio 51lbvkgKkQJ6MXsnH5+JhkhTgfLgHJKnxH9/b4UgqBbQMA6GzM5BCWtf3783yHeMn2tp emPNRMLYtqVXX0O3vsmaw7V5SXCakX92vzc7eEobDebqOLVsXAU2GaJ9chszrMWyoqfT IG0Q== X-Gm-Message-State: AOAM5336dpVZue49G57byaNuAnEzDhST8jkOkbYgQ/sp29qR5XmHbS5z JIrWXUn0gImF7ammVGO7vzjJraX8 X-Google-Smtp-Source: ABdhPJwH+OKWtmcn+io2yUnbEZt++JkZreFXGPqCajdSc7RlJ8lpjCsO6Edl2PSox7IlQIsOotctpQ== X-Received: by 2002:a5d:5483:: with SMTP id h3mr5503276wrv.10.1591815937063; Wed, 10 Jun 2020 12:05:37 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id 5sm1544197wrr.5.2020.06.10.12.05.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jun 2020 12:05:36 -0700 (PDT) Subject: Re: bug#41779: Fall back between vc-diff and diff-backup To: Juri Linkov , 41779@debbugs.gnu.org References: <505E43E1.9090801@yandex.ru> <505E4A57.5020305@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> From: Dmitry Gutov Message-ID: Date: Wed, 10 Jun 2020 22:05:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <87mu5b24ob.fsf_-_@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41779 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 10.06.2020 02:35, Juri Linkov wrote: > Therefore, this patch to the rescue: Considering that 'M-=' is not a default binding, and diff-backup doesn't have one, how about creating a new command? You could just as well bind it to 'M-='. The command could be called 'diff-dwim'. Or 'diff-vc-or-backup'. Regarding the proposed patch, I'm somewhat uneasy making 'vc-diff' (the command which purpose is to compare edits against the "saved" snapshot in version control) diff against the backup (lifetime of which is very unclear to me). Or vice versa. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 17:56:37 2020 Received: (at 41779) by debbugs.gnu.org; 10 Jun 2020 21:56:37 +0000 Received: from localhost ([127.0.0.1]:35518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj8i4-0005B2-RR for submit@debbugs.gnu.org; Wed, 10 Jun 2020 17:56:37 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:40241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj8i2-0005AO-9U for 41779@debbugs.gnu.org; Wed, 10 Jun 2020 17:56:34 -0400 X-Originating-IP: 91.129.108.6 Received: from mail.gandi.net (m91-129-108-6.cust.tele2.ee [91.129.108.6]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 234E7C0009; Wed, 10 Jun 2020 21:56:27 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#41779: Fall back between vc-diff and diff-backup Organization: LINKOV.NET References: <505E43E1.9090801@yandex.ru> <505E4A57.5020305@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> Date: Thu, 11 Jun 2020 00:53:56 +0300 In-Reply-To: (Dmitry Gutov's message of "Wed, 10 Jun 2020 22:05:35 +0300") Message-ID: <871rmmoadn.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 41779 Cc: 41779@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Considering that 'M-=' is not a default binding, and diff-backup doesn't > have one, how about creating a new command? You could just as well bind > it to 'M-='. > > The command could be called 'diff-dwim'. Or 'diff-vc-or-backup'. > > Regarding the proposed patch, I'm somewhat uneasy making 'vc-diff' (the > command which purpose is to compare edits against the "saved" snapshot > in version control) diff against the backup (lifetime of which is very > unclear to me). Or vice versa. Why do you think that throwing an error is more useful than doing some nice fallback? From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 18:18:33 2020 Received: (at 41779) by debbugs.gnu.org; 10 Jun 2020 22:18:33 +0000 Received: from localhost ([127.0.0.1]:35542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj93I-0005je-UP for submit@debbugs.gnu.org; Wed, 10 Jun 2020 18:18:33 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:42252) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj93H-0005jN-7N for 41779@debbugs.gnu.org; Wed, 10 Jun 2020 18:18:31 -0400 Received: by mail-wr1-f43.google.com with SMTP id p5so4047880wrw.9 for <41779@debbugs.gnu.org>; Wed, 10 Jun 2020 15:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=B2SG8+7+GWaXVUU6vCSX/21vT1VKLcWLyBH36h1xq58=; b=p1RuIc06W07ZLmcob/8P0bydwjFR63heJxjSkT7lUST8H3fw2XMYnA1rqyCSopIme+ rGPHjRRfV9hMNyKMIy1ERbuXQKhr9krLUVy/teCG+bOfUu8fWSWevFMcj7bZ08rqOXPz x9iLR0KSvKJEKyxLGvvnzT8i9iWYtC8e144FiMvKf6VQnI7PGUKYlg/f/XbOLfRknQKp 7w3o4mIsRE25nunWmFtzvlLAdMm0JhvMQIXRJQdIwAbbqSxKvE+4rpCikNFY+UJTW3m8 0chqd5Oh00FTi1EEb2nO/Z1E6EE07u41yDnrVas3dGQ5YpqLFfPiBSyTWfGEmf6GBAOi wP/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=B2SG8+7+GWaXVUU6vCSX/21vT1VKLcWLyBH36h1xq58=; b=XjLYhFI2lxKj0aXT/cIkmeYJNUaSnfdDXxZwqWHMmhEmkiOTdra3UVtOw/6hJnXNnK IFcidw5pg47vmwjLow+eRSU4dpSzDvkazp8af+XDhK+yDC0mH7ozcuD8GidQCGb9HxZG muIaj04H/bB1u8Rg+Z2I+F81Kpn1HhOdWIt3K6EXQh9kwfE0h88CbTWUQ7MXyVZDZ/7H vzhYboV9Iz3kAV4kuo10I6xp7b9z2bUMYutwQ5dzsddstny/AkCBjsHFLk8kROMEYFyN E/3UtDVjaP/lDDyikcINpBg0Hg8bSVqqh/IBIdOSuG3DAxJJebDmD+eIggRKcnWbZgf/ Qw/A== X-Gm-Message-State: AOAM5329urlucmFiwOZ+wje5c3JeYOMCtzt0wMoLPGFHTNbzHzwMoyXU FbIiqeRSuyU5FQVDO79hmSI6+O+Q X-Google-Smtp-Source: ABdhPJw4+eG82oUJ8vCFoJQvM/dF3T/5mLFfh15z8SI9FtzlDr68Y+cE8f12xpR12S1kkKntxhw58A== X-Received: by 2002:a5d:49c4:: with SMTP id t4mr5849297wrs.127.1591827504964; Wed, 10 Jun 2020 15:18:24 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id e12sm1634901wro.52.2020.06.10.15.18.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jun 2020 15:18:24 -0700 (PDT) Subject: Re: bug#41779: Fall back between vc-diff and diff-backup To: Juri Linkov References: <505E43E1.9090801@yandex.ru> <505E4A57.5020305@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> From: Dmitry Gutov Message-ID: <4d00562c-e042-2519-eb18-b2ef009da6e6@yandex.ru> Date: Thu, 11 Jun 2020 01:18:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <871rmmoadn.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41779 Cc: 41779@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 11.06.2020 00:53, Juri Linkov wrote: > Why do you think that throwing an error is more useful than doing > some nice fallback? It's... imprecise? Like, if I'm using the 'C-x v' prefix, I expect to work against a VC repository. Having a command like that succeed despite the lack of said repository could give a wrong impression to the user. Not a big problem, but the cost of implementing a different solution doesn't seem to be high either. Admittedly, I use diff-backup very rarely (though it does happen from time to time), so I might not understand your usage scenarios well. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 19:20:54 2020 Received: (at 41779) by debbugs.gnu.org; 10 Jun 2020 23:20:54 +0000 Received: from localhost ([127.0.0.1]:35605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjA1e-000109-6t for submit@debbugs.gnu.org; Wed, 10 Jun 2020 19:20:54 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:51819) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjA1b-0000zc-NM for 41779@debbugs.gnu.org; Wed, 10 Jun 2020 19:20:52 -0400 X-Originating-IP: 91.129.108.6 Received: from mail.gandi.net (m91-129-108-6.cust.tele2.ee [91.129.108.6]) (Authenticated sender: juri@linkov.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 88E1BFF805; Wed, 10 Jun 2020 23:20:44 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#41779: Fall back between vc-diff and diff-backup Organization: LINKOV.NET References: <505E43E1.9090801@yandex.ru> <505E4A57.5020305@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> Date: Thu, 11 Jun 2020 02:17:02 +0300 In-Reply-To: <4d00562c-e042-2519-eb18-b2ef009da6e6@yandex.ru> (Dmitry Gutov's message of "Thu, 11 Jun 2020 01:18:23 +0300") Message-ID: <874krilde9.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 41779 Cc: 41779@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> Why do you think that throwing an error is more useful than doing >> some nice fallback? > > It's... imprecise? Like, if I'm using the 'C-x v' prefix, I expect to work > against a VC repository. Having a command like that succeed despite the > lack of said repository could give a wrong impression to the user. > > Not a big problem, but the cost of implementing a different solution > doesn't seem to be high either. > > Admittedly, I use diff-backup very rarely (though it does happen from time > to time), so I might not understand your usage scenarios well. So for the normal usage, users won't notice this additional feature, and in case of the user error it comes to the rescue. 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. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 19:26:15 2020 Received: (at 41779) by debbugs.gnu.org; 10 Jun 2020 23:26:15 +0000 Received: from localhost ([127.0.0.1]:35616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjA6p-00019Y-0W for submit@debbugs.gnu.org; Wed, 10 Jun 2020 19:26:15 -0400 Received: from mail-wm1-f42.google.com ([209.85.128.42]:55444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjA6n-00019K-IN for 41779@debbugs.gnu.org; Wed, 10 Jun 2020 19:26:14 -0400 Received: by mail-wm1-f42.google.com with SMTP id c71so3352318wmd.5 for <41779@debbugs.gnu.org>; Wed, 10 Jun 2020 16:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=cCMm+fAoiLlmwkuN4xAeVJxi95PwE0QBkmPKvaLZNHk=; b=AeugVLudkELKVedsPjAc60tt/fMl6WYZPWnjPWOuiFn1WBynBf+2uAbRgAXgb/oh9d jMWf2iwwwYAv6veEC5GlliHwVNGIN0bwzZ3BBTpxSCbkcFxhyODX3ocC+SaXwiH18FAR kwd+dNNiyqtoVczHbs0wOnbaNtra/3ZJkBxyW+3phgSN000wdRnk/Il3jstef7+vMJfK Nuq318GW3VtFtjJU5hfHnBxSnblQnl9IeF4tmJ3haPXteOLoD9tsSNS38lJSdMY7CM/c wFksk+Mo5gXAA6ZKNtN/fHBgEWsnQwKSnGqOVRf0XWhELSYrpmzjPELcn1eImZUfTjMg /p1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cCMm+fAoiLlmwkuN4xAeVJxi95PwE0QBkmPKvaLZNHk=; b=XM+NvVI2tRpooLXv7ZZATYZnkEMnPeeULQB80s57cICHl9Dguqy1FmIzgvS2wQHZad kdZivrz6EzJp/OXmIJ0f7OyC99roPJuJ/XjnXy3jU8DqCzmtgSvPwBS934BlVqL5h35u M6s1iY3LxBSSPTK9MFKKCesVbGtRl/Db3ndhEJ5z25PLs3jsfBfEYAETQ7JCnOSEuERf w+xp09L4jFhxdb4Me+6kkHdTgUwGsK9fCNV0cXyfM/FNeDQGo/SE2+I3itSX4iHQXbXm u97FJQBRLaEfTQs8LoWxmRqTGE89fgH7+toZQ7/So2xEm596NKxhQkEaabBscMrkQe1v LwQQ== X-Gm-Message-State: AOAM5308GvRULL7Pg3ab4R4SFBqyk6LsTx387pMXrnT5CuAp3/I7uJbq 9gkShAmhJ3RCg8SHQs7E5rRGJnlY X-Google-Smtp-Source: ABdhPJxDkIULgAaVRMrN0H1bvMyJiZMIMLLg0d95/E6FxoFyUdbaVGUe7WPKt4SVftJAbTkkd1dR6g== X-Received: by 2002:a1c:9613:: with SMTP id y19mr5147479wmd.135.1591831567688; Wed, 10 Jun 2020 16:26:07 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id y132sm1620875wmb.11.2020.06.10.16.26.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jun 2020 16:26:07 -0700 (PDT) Subject: Re: bug#41779: Fall back between vc-diff and diff-backup To: Juri Linkov References: <505E43E1.9090801@yandex.ru> <505E4A57.5020305@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> From: Dmitry Gutov Message-ID: <41eb53fd-3973-8812-a7f4-403e02e4164e@yandex.ru> Date: Thu, 11 Jun 2020 02:26:05 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <874krilde9.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41779 Cc: 41779@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 11.06.2020 02:17, Juri Linkov wrote: > So for the normal usage, users won't notice this additional feature, > and in case of the user error it comes to the rescue. In a way that is likely to make the user miss the fact that there was a misconception. > 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. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 19:46:53 2020 Received: (at 41779) by debbugs.gnu.org; 24 Jun 2020 23:46:53 +0000 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 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 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) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#41779: Fall back between vc-diff and diff-backup Organization: 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> Date: Thu, 25 Jun 2020 02:32:32 +0300 In-Reply-To: <41eb53fd-3973-8812-a7f4-403e02e4164e@yandex.ru> (Dmitry Gutov's message of "Thu, 11 Jun 2020 02:26:05 +0300") Message-ID: <87y2ocavlb.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 41779 Cc: 41779@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) 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))) From unknown Fri Jun 20 07:12:08 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 23 Jul 2020 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator