From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#52242: 29.0.50; Feature Request: Offer to run`diff-buffer-with-file' in `recover-this-file' prompt Date: Wed, 06 Dec 2023 13:52:59 +0530 Message-ID: <8734wfwxi4.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37149"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 52242@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 06 09:24:17 2023 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 1rAnCa-0009Tk-Li for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Dec 2023 09:24:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rAnCF-0004Q7-Ns; Wed, 06 Dec 2023 03:23:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rAnCC-0004Pl-JX for bug-gnu-emacs@gnu.org; Wed, 06 Dec 2023 03:23:52 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rAnCB-00006u-5l for bug-gnu-emacs@gnu.org; Wed, 06 Dec 2023 03:23:51 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rAnCM-0000lA-Ea for bug-gnu-emacs@gnu.org; Wed, 06 Dec 2023 03:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Dec 2023 08:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52242 X-GNU-PR-Package: emacs Original-Received: via spool by 52242-submit@debbugs.gnu.org id=B52242.17018510042876 (code B ref 52242); Wed, 06 Dec 2023 08:24:02 +0000 Original-Received: (at 52242) by debbugs.gnu.org; 6 Dec 2023 08:23:24 +0000 Original-Received: from localhost ([127.0.0.1]:38815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rAnBk-0000kJ-Dq for submit@debbugs.gnu.org; Wed, 06 Dec 2023 03:23:24 -0500 Original-Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:56396) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rAnBg-0000k4-MV for 52242@debbugs.gnu.org; Wed, 06 Dec 2023 03:23:23 -0500 Original-Received: by mail-pl1-x642.google.com with SMTP id d9443c01a7336-1d069b1d127so26640155ad.0 for <52242@debbugs.gnu.org>; Wed, 06 Dec 2023 00:23:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701850983; x=1702455783; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=M6erJLn8akfWMzYMYynNXSeLnGaZOeekMZrr6PYVwRc=; b=W6jEg7fRDTttiueSA8m/HrpYbUNrDbw/E0M438MN8+bxUviDWf+Yd7ZazVCRUsS+a8 Qx7ZUaQEQdr++Voyk+1W2Bb3OepfASrMCtO291UHs9OX2JRP19KN/82ws3cE0nrWnYwL woaQV6nh4LOLvwGy8HV2tfVE/nQHO8GlQkvIAUrOBNP30cbQHoB6viMXIhbbw1f7snCF tOQaf4cZhog9N0P9+v7NlMU+jQYvMqYaVlwn2m0hrdsjv5swb8vE2uQVqr00haBuySnf VCLFAJXaNup4ZrVw8yz0tQ3w7hweeqrCCB/RqEAVfceGCVKyLb3SGDxl8GXnFx76oVPL ilzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701850983; x=1702455783; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=M6erJLn8akfWMzYMYynNXSeLnGaZOeekMZrr6PYVwRc=; b=TA87Cmgq7JSksVOuebOdWZPt7rpumNHJ0rLnbgTKETs/161B5hlGw5TEzmOWuQRPxN 9s5aVMRCMcdxmfAcfBgu/hhg3o7VY756+4++PHBH1/HKYCFImawasYKkzqhZNkf2Q2z0 7rLYpmHBeKnRqrjrzV//jeBINziTFmXTBWKLSPfM47yjWZ7IUiwrPRkBCLTiayPSY+JP m7FT7DjYoFhv+eDM5ydGkMRF8HqysQO7mJK8F5dzSsiHg+8+5o5gJsCpvBIddM0t9XNs vHdXTo7UaMdG8QhsY8CPwDRQK3m10/Ag4duF7C32yhXirCjLJz21PewLUoSsvliBT2WX 9GzA== X-Gm-Message-State: AOJu0YxZ7sfa2dmCLxgO0VnF3YS+UipBm14Qdj5aLvM/mE1Gw7TP8+Mk /mwcvBO4P8uzBl6LfkQzm7cUucYOxfHKWQ== X-Google-Smtp-Source: AGHT+IEAqXDWfoQhxmgGml60ouTCKj3KwLuD+Ead2ghmLQUyI1wDkJm8hrXHMZk3YlWgD0/Qo2jaUw== X-Received: by 2002:a17:902:e846:b0:1d0:c7c6:91a2 with SMTP id t6-20020a170902e84600b001d0c7c691a2mr322056plg.100.1701850982822; Wed, 06 Dec 2023 00:23:02 -0800 (PST) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id l6-20020a170903244600b001cf658f20ecsm7606574pls.96.2023.12.06.00.23.01 for <52242@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 00:23:01 -0800 (PST) In-Reply-To: (visuwesh@tutanota.com's message of "Thu, 2 Dec 2021 13:28:24 +0100 (CET)") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275584 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=E0=AF=8D =E0=AE=9F= =E0=AE=BF=E0=AE=9A=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE=B0=E0=AF=8D 02, 2021] V= isuwesh wrote: > `recover-this-file' quite helpfully shows the time of creation of the > auto-save file.=C2=A0 However, this is not always enough to decide whethe= r I > should recover from said auto-save file since there's no way of knowing > if the changes in auto-save file are desirable [1] so I end up answering > yes, then run `diff-buffer-with-file' anyway.=C2=A0 I think having a > `diff-buffer-with-file' option like `save-some-buffers' would be a > quality-of-life improvement. Please find attached path that uses read-answer to present the diff. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Offer-to-show-diff-against-auto-save-in-recover-file.patch >From d64f8a1307ab82216b5f97982494945547810f64 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Wed, 6 Dec 2023 13:45:03 +0530 Subject: [PATCH] Offer to show diff against auto-save in recover-file * lisp/files.el (recover-file): Show diff against the selected auto save file. bug#52242 * etc/NEWS: Announce the new feature. --- etc/NEWS | 4 ++++ lisp/files.el | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 29f4e5c0b66..6c2a584c355 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -258,6 +258,10 @@ called in the '--eval' expression, which is useful when those arguments contain arbitrary characters that otherwise might require elaborate and error-prone escaping (to protect them from the shell). +** 'recover-this-file' can show diff between auto save file and current file. +When answering the prompt with "diff" or "=", it now shows the diff +between the auto save file and the current file. + * Editing Changes in Emacs 30.1 diff --git a/lisp/files.el b/lisp/files.el index 1cdcec23b11..d70524e4775 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7083,7 +7083,15 @@ recover-file #'(lambda (window _value) (with-selected-window window (unwind-protect - (yes-or-no-p (format "Recover auto save file %s? " file-name)) + (let ((prompt (format "Recover auto save file %s? " file-name)) + (choices + '(("yes" ?y "recover auto save file") + ("no" ?n "don't recover auto save file") + ("diff" ?= "diff auto save file with current file"))) + ans) + (while (equal "diff" (setq ans (read-answer prompt choices))) + (diff file file-name)) + (equal ans "yes")) (when (window-live-p window) (quit-restore-window window 'kill))))) (with-current-buffer standard-output -- 2.42.0 --=-=-=--