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: Mon, 11 Dec 2023 09:44:50 +0530 Message-ID: <87jzplv0hx.fsf@gmail.com> References: <8734wfwxi4.fsf@gmail.com> <87wmtqvaqb.fsf@gmail.com> <83h6kryb35.fsf@gnu.org> <87o7eyuqzn.fsf@gmail.com> 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="18265"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 52242@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 11 05:16:11 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 1rCXiF-0004b6-2r for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Dec 2023 05:16:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rCXhx-0000R2-LZ; Sun, 10 Dec 2023 23:15:53 -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 1rCXhs-0000Qn-7Z for bug-gnu-emacs@gnu.org; Sun, 10 Dec 2023 23:15:49 -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 1rCXhr-0001mz-IY for bug-gnu-emacs@gnu.org; Sun, 10 Dec 2023 23:15:47 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rCXi6-0000mu-28 for bug-gnu-emacs@gnu.org; Sun, 10 Dec 2023 23:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Dec 2023 04:16: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.17022681192965 (code B ref 52242); Mon, 11 Dec 2023 04:16:02 +0000 Original-Received: (at 52242) by debbugs.gnu.org; 11 Dec 2023 04:15:19 +0000 Original-Received: from localhost ([127.0.0.1]:52225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCXhO-0000li-NO for submit@debbugs.gnu.org; Sun, 10 Dec 2023 23:15:19 -0500 Original-Received: from mail-yw1-x1142.google.com ([2607:f8b0:4864:20::1142]:56764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCXhL-0000lL-4X for 52242@debbugs.gnu.org; Sun, 10 Dec 2023 23:15:17 -0500 Original-Received: by mail-yw1-x1142.google.com with SMTP id 00721157ae682-5d747dbf81eso33049447b3.1 for <52242@debbugs.gnu.org>; Sun, 10 Dec 2023 20:15:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702268095; x=1702872895; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ECY4q++xeBdedASGMA7W2HNEI7nlW65jENMWKfCog24=; b=KHQEB0VYW5riNvILeOvrODiBzysKwH90QUToegOGlxxyHru1w4n1CslYIYxD0k7jcR Ps/b2JNURXCbgeYP3N3BhSwh5p6OLlxhuoE4dxwMJfqowQCyhwmbt7IJkAMB0X4qFNPj 8t+/9KRHARVwsiBnlH8zGaMQvdbcyen0mr69SHdwhJSUfaS87MIOWs8v1RTm044Yx5Dd njmmHJJZN7FBuMUL2cvFWrqdHmb0ueu9xMnWGYhOvNaYWQXX/WxPeRUFvq5ksqAt3MK4 6ekqwcKQDdIsuIWr8uxU3DliBZQJjmBf/fF3qn1JPSoks20G6de4nuZNyrU2gq0sFHFu 8NPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702268095; x=1702872895; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ECY4q++xeBdedASGMA7W2HNEI7nlW65jENMWKfCog24=; b=ZYTJSMMioxiA1HkqXwsgwyMHOEDOkXBs1kqhOZ2d+NAI1X0zLQhgXEu1ivgaHWttOD dR8ZfVNuilDwTqu1M7scQHm1FCapvsFDGDwC5HKyfIXD6CQgA2DesXBNDonEoGbCUbEV mzj55OCnJpUD7QK8vPQb/66LNfjmGSLTWKXyPljACienTb949ZaBHmQjoHTN265xddID KViEV4N4LDrwqWy2AV1vvbBEISJfyqUYRsquK3uuqkqCNvA1ql8Hkjm7FZB+MUNP5mQN ZSkLQPm+t6AtUUpv1wvTBXyN77vq3C/gYvUIPbQcfdwOQuQtt5MMT4H0xGibPnal3hPq 1D9A== X-Gm-Message-State: AOJu0YxTClhMqH5qWUAluplXHSAfgClbBUROey9ytehzEyjBkqMWB1LZ Rr1jH8m2nqgs3qyvTVDFTjcshSVKY2BPng== X-Google-Smtp-Source: AGHT+IGflTWmCSyNc72/+kdhy7+D3XYSKsBuLg2yNE52XGXxUomlALI0Ix759RLAPmBTPXzmNPlb6w== X-Received: by 2002:a81:77c6:0:b0:5d7:1941:a9a with SMTP id s189-20020a8177c6000000b005d719410a9amr2842102ywc.53.1702268094579; Sun, 10 Dec 2023 20:14:54 -0800 (PST) Original-Received: from localhost ([49.205.83.111]) by smtp.gmail.com with ESMTPSA id g13-20020a170902d5cd00b001d1d6f6b67dsm5505334plh.147.2023.12.10.20.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 20:14:53 -0800 (PST) In-Reply-To: <87o7eyuqzn.fsf@gmail.com> (Visuwesh's message of "Sun, 10 Dec 2023 18:57:56 +0530") 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:275962 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 W+CunuCuvuCur+Cuv+CuseCvgSDgrp/grr/grprgrq7gr43grqrgrrDgr40gMTAsIDIwMjNdIFZp c3V3ZXNoIHdyb3RlOg0KDQpKdXN0IG5vdGljZWQgdGhhdCBJIGhhZCBhbiB1bnJlbGF0ZWQgZmls bGluZyBjaGFuZ2Ugc25lYWsgaW4sIHRoZQ0KYXR0YWNoZWQgcGF0Y2ggb21pdHMgdGhhdC4gIFNv cnJ5IGZvciB0aGUgbm9pc2UuDQoNCg== --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Offer-to-show-diff-against-auto-save-in-recover-file.patch >From d4ce87ae26c3c43851841432d4f3e1b3f5404f75 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) * doc/emacs/files.texi (Recover): Document the new feature. * etc/NEWS: Announce the new feature. --- doc/emacs/files.texi | 4 ++++ etc/NEWS | 5 +++++ lisp/files.el | 10 +++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 917e937d32d..832c189ce49 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1329,6 +1329,10 @@ Recover so you can compare their sizes and dates. If the auto-save file is older, @kbd{M-x recover-file} does not offer to read it. +When @kbd{M-x recover-file} asks for confirmation, if you answer with +@kbd{diff} or @kbd{=}, it shows the diffs between @var{file} and its +auto-save file @file{#@var{file}#} and reprompts you for confirmation. + @findex recover-session If Emacs or the computer crashes, you can recover all the files you were editing from their auto save files with the command @kbd{M-x diff --git a/etc/NEWS b/etc/NEWS index 29f4e5c0b66..39708d866d3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -258,6 +258,11 @@ 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-file' can show diffs between auto save file and current file. +When answering the prompt with "diff" or "=", it now shows the diffs +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..83534e0080c 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" ?= "show changes between auto save file and 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 --=-=-=--