GNU bug report logs - #52242
29.0.50; Feature Request: Offer to run`diff-buffer-with-file' in `recover-this-file' prompt

Previous Next

Package: emacs;

Reported by: Visuwesh <visuwesh <at> tutanota.com>

Date: Thu, 2 Dec 2021 12:29:02 UTC

Severity: wishlist

Merged with 53280, 58253

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52242 in the body.
You can then email your comments to 52242 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#52242; Package emacs. (Thu, 02 Dec 2021 12:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Visuwesh <visuwesh <at> tutanota.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 02 Dec 2021 12:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuwesh <at> tutanota.com>
To: Bug Gnu Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 29.0.50;  Feature Request: Offer to run`diff-buffer-with-file' in
 `recover-this-file' prompt
Date: Thu, 2 Dec 2021 13:28:24 +0100 (CET)
`recover-this-file' quite helpfully shows the time of creation of the
auto-save file.  However, this is not always enough to decide whether 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.  I think having a
`diff-buffer-with-file' option like `save-some-buffers' would be a
quality-of-life improvement.

Thanks.
[1] I fat finger my keyboard quite a lot and end up garbling the file
even after explicitly saving the buffer.  When I open the file in a new
Emacs session again, I get suggested to `recover-this-file' and 8/10
times, I have to undo.  Having a diff option directly in the prompt
would save some keystrokes.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.16.0)
Repository revision: da67e888d5360297cdf20cd3d2a1148727d16e5a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12012000
System Description: NixOS 21.11 (Porcupine)

Configured using:
'configure
--prefix=/nix/store/mlv737k3wph8lhxi2lm9942kbm31wmdz-emacs-gcc-20211030.0
--disable-build-details --with-modules --with-x-toolkit=gtk3 --with-xft
--with-cairo --with-native-compilation'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH:
  value of $EMACSNATIVELOADPATH: /nix/store/hagxad2bnmdwy79yjkvkwjjynxpik7fw-emacs-packages-deps/share/emacs/native-lisp::
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  TeX-PDF-mode: t
  recentf-mode: t
  paredit-mode: t
  eros-mode: t
  flymake-mode: t
  hl-todo-mode: t
  pdf-occur-global-minor-mode: t
  shell-dirtrack-mode: t
  minibuffer-depth-indicate-mode: t
  repeat-mode: t
  display-time-mode: t
  display-battery-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
/home/viz/.nix-profile/share/emacs/site-lisp/site-start hides /nix/store/hagxad2bnmdwy79yjkvkwjjynxpik7fw-emacs-packages-deps/share/emacs/site-lisp/site-start
/home/viz/lib/emacs/straight/build/map/map hides /nix/store/mlv737k3wph8lhxi2lm9942kbm31wmdz-emacs-gcc-20211030.0/share/emacs/29.0.50/lisp/emacs-lisp/map
/home/viz/lib/emacs/straight/build/let-alist/let-alist hides /nix/store/mlv737k3wph8lhxi2lm9942kbm31wmdz-emacs-gcc-20211030.0/share/emacs/29.0.50/lisp/emacs-lisp/let-alist

Features:
(shadow sort emacsbug sendmail reporter preview tex-buf
latex-mode-expansions latex latex-flymake tex-ispell tex-style tex crm
trace edebug hippie-exp re-builder holidays hol-loaddefs cal-move
autoload math-delimiters cursor-sensor org-pdftools pdf-annot facemenu
org-noter executable time-stamp comp comp-cstr cl-print debug backtrace
thai-util thai-word misearch multi-isearch view mule-util
ement-room-list ement ement-notify ement-room ewoc ement-api
ement-structs ement-macros plz dns ts s etags fileloop xref rect
mail-extr wdired dired-aux shortdoc dired-x help-fns radix-tree
expand-region text-mode-expansions cc-mode-expansions
the-org-mode-expansions er-basic-expansions expand-region-core
expand-region-custom pulse color reveal recentf tree-widget vc-git
diff-mode vc-dispatcher server paredit edmacro kmacro eros checkdoc
lisp-mnt flymake-proc flymake project hl-todo writegood-mode-autoloads
ement-autoloads ts-autoloads s-autoloads map-autoloads plz-autoloads
transmission-autoloads lua-mode-autoloads nix-mode-autoloads
magit-section-autoloads racket-mode-autoloads eros-autoloads
flymake-shellcheck-autoloads avy avy-autoloads siege-mode
siege-mode-autoloads paredit-autoloads expand-region-autoloads
filladapt-autoloads compose quail notifications org-capture doct
warnings org-refile org-clock scroll-other-window org-pdftools-autoloads
org-noter-autoloads finder-inf pdf-occur ibuf-ext ibuffer
ibuffer-loaddefs tablist tablist-filter semantic/wisent/comp
semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util
semantic semantic/tag semantic/lex semantic/fw mode-local cedet
pdf-isearch let-alist pdf-misc imenu pdf-tools package url-handlers
compile cus-edit pdf-view bookmark pp pdf-cache pdf-info tq pdf-util
pdf-macs pdf-tools-autoloads let-alist-autoloads tablist-autoloads
math-delimiters-autoloads doct-autoloads valign flyspell ispell
face-remap goto-addr org-indent org-num org-element avl-tree generator
ol-eww eww xdg url-queue thingatpt mm-url ol-rmail ol-mhe ol-irc ol-info
ol-gnus nnselect gnus-search eieio-opt speedbar ezimage dframe gnus-art
mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom
browse-url gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search
mail-utils mm-util mail-prsvr wid-edit ol-docview doc-view jka-compr
image-mode exif dired dired-loaddefs ol-bibtex ol-bbdb ol-w3m ol-doi
org-link-doi ob-C cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs ob-shell shell ob-racket dash async
ob-async org-starless cdlatex texmathp org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete
pcomplete comint ansi-color ring org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob-core ob-eval org-table
oc-basic bibtex iso8601 time-date ol org-keys oc org-compat advice
org-macs org-loaddefs find-func ob-async-autoloads dash-autoloads
async-autoloads emacs-ob-racket-autoloads valign-autoloads easy-mmode
org-starless-autoloads cdlatex-autoloads auctex-autoloads tex-site tempo
derived mb-depth cus-load repeat visual-fill-autoloads
olivetti-autoloads hl-todo-autoloads moody-autoloads time format-spec
battery dbus filenotify xml disp-table vz-nh-theme shell-command+
shell-command-plus-autoloads icalendar diary-lib diary-loaddefs cal-menu
calendar cal-loaddefs url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse auth-source eieio
eieio-core eieio-loaddefs password-cache json map url-vars mailcap rx
chemtable chemtable-autoloads molar-mass-autoloads pcase
straight-autoloads info cl-seq cl-extra help-mode straight cl-macs
cl-loaddefs cl-lib seq gv subr-x byte-opt bytecomp byte-compile cconv
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 1208185 292637)
(symbols 48 42228 4)
(strings 32 303314 43731)
(string-bytes 1 8562492)
(vectors 16 108614)
(vector-slots 8 2355085 365629)
(floats 8 691 1499)
(intervals 56 52079 12887)
(buffers 992 50))





Forcibly Merged 52242 53280. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 15 Jan 2022 10:15:03 GMT) Full text and rfc822 format available.

Forcibly Merged 52242 53280 58253. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 02 Oct 2022 16:09:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52242; Package emacs. (Wed, 06 Dec 2023 08:24:02 GMT) Full text and rfc822 format available.

Message #12 received at 52242 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: 52242 <at> debbugs.gnu.org
Subject: Re: 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 part 1 (text/plain, inline)]
[வியாழன் டிசம்பர் 02, 2021] Visuwesh wrote:

> `recover-this-file' quite helpfully shows the time of creation of the
> auto-save file.  However, this is not always enough to decide whether 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.  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.

[0001-Offer-to-show-diff-against-auto-save-in-recover-file.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52242; Package emacs. (Thu, 07 Dec 2023 05:33:02 GMT) Full text and rfc822 format available.

Message #15 received at 52242 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: 52242 <at> debbugs.gnu.org
Subject: Re: bug#52242: 29.0.50;  Feature Request: Offer to
 run`diff-buffer-with-file' in `recover-this-file' prompt
Date: Thu, 07 Dec 2023 11:02:28 +0530
[Message part 1 (text/plain, inline)]
[புதன் டிசம்பர் 06, 2023] Visuwesh wrote:

> [வியாழன் டிசம்பர் 02, 2021] Visuwesh wrote:
>
>> `recover-this-file' quite helpfully shows the time of creation of the
>> auto-save file.  However, this is not always enough to decide whether 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.  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.

I didn't notice that recover-file was covered in the Emacs manual, I
have now updated the manual and marked the NEWS entry accordingly in the
attached patch.

[0001-Offer-to-show-diff-against-auto-save-in-recover-file.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52242; Package emacs. (Sat, 09 Dec 2023 09:34:01 GMT) Full text and rfc822 format available.

Message #18 received at 52242 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 52242 <at> debbugs.gnu.org
Subject: Re: bug#52242: 29.0.50;
 Feature Request: Offer to run`diff-buffer-with-file' in
 `recover-this-file' prompt
Date: Sat, 09 Dec 2023 11:33:18 +0200
> From: Visuwesh <visuweshm <at> gmail.com>
> Date: Thu, 07 Dec 2023 11:02:28 +0530
> 
> I didn't notice that recover-file was covered in the Emacs manual, I
> have now updated the manual and marked the NEWS entry accordingly in the
> attached patch.

Thanks, I have a few comments:

> diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
> index 917e937d32d..c791a6f1c98 100644
> --- a/doc/emacs/files.texi
> +++ b/doc/emacs/files.texi
> @@ -1325,9 +1325,11 @@ Recover
>  @end example
>  
>    Before asking for confirmation, @kbd{M-x recover-file} displays a
> -directory listing describing the specified file and the auto-save file,
> -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.
> +directory listing describing the specified file and the auto-save
> +file, so you can compare their sizes and dates.  If you answer
> +@kbd{diff}, it shows the diff between @var{file} and its auto-save
> +file @file{#@var{file}#}.  If the auto-save file is older, @kbd{M-x
> +recover-file} does not offer to read it.

It is better to make the documentation of the 'diff' response separate
from the rest, since the original text doesn't describe the responses
at all, it only mentions the need for confirmation.

So I suggest to leave the text starting at "Before asking for
confirmation" alone, and add a new paragraph after that one, like
this:

  When @kbd{M-x recover-file} asks for confirmation, if you respond
  with @kbd{diff} or @kbd{=}, it shows the diffs between ...

> ++++
> +** 'recover-file' can show diff between auto save file and current file.
                              ^^^^
We use "diffs", plural.

> +When answering the prompt with "diff" or "=", it now shows the diff
                                                                  ^^^^
Same here.

> +between the auto save file and the current file.
> +                            (choices
> +                             '(("yes" ?y "recover auto save file")
> +                               ("no" ?n "don't recover auto save file")
> +                               ("diff" ?= "diff auto save file with current file")))
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Maybe a better text would be

   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"))

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52242; Package emacs. (Sun, 10 Dec 2023 13:29:01 GMT) Full text and rfc822 format available.

Message #21 received at 52242 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52242 <at> debbugs.gnu.org
Subject: Re: bug#52242: 29.0.50; Feature Request: Offer to
 run`diff-buffer-with-file' in `recover-this-file' prompt
Date: Sun, 10 Dec 2023 18:57:56 +0530
[Message part 1 (text/plain, inline)]
[சனி டிசம்பர் 09, 2023] Eli Zaretskii wrote:

>> From: Visuwesh <visuweshm <at> gmail.com>
>> Date: Thu, 07 Dec 2023 11:02:28 +0530
>> 
>> I didn't notice that recover-file was covered in the Emacs manual, I
>> have now updated the manual and marked the NEWS entry accordingly in the
>> attached patch.
>
> Thanks, I have a few comments:

Thanks for the review.

>> diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
>> index 917e937d32d..c791a6f1c98 100644
>> --- a/doc/emacs/files.texi
>> +++ b/doc/emacs/files.texi
>> @@ -1325,9 +1325,11 @@ Recover
>>  @end example
>>  
>>    Before asking for confirmation, @kbd{M-x recover-file} displays a
>> -directory listing describing the specified file and the auto-save file,
>> -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.
>> +directory listing describing the specified file and the auto-save
>> +file, so you can compare their sizes and dates.  If you answer
>> +@kbd{diff}, it shows the diff between @var{file} and its auto-save
>> +file @file{#@var{file}#}.  If the auto-save file is older, @kbd{M-x
>> +recover-file} does not offer to read it.
>
> It is better to make the documentation of the 'diff' response separate
> from the rest, since the original text doesn't describe the responses
> at all, it only mentions the need for confirmation.
>
> So I suggest to leave the text starting at "Before asking for
> confirmation" alone, and add a new paragraph after that one, like
> this:
>
>   When @kbd{M-x recover-file} asks for confirmation, if you respond
>   with @kbd{diff} or @kbd{=}, it shows the diffs between ...

OK, I made it into a separate paragraph and added that it reprompts for
confirmation.

>> ++++
>> +** 'recover-file' can show diff between auto save file and current file.
>                               ^^^^
> We use "diffs", plural.
>
>> +When answering the prompt with "diff" or "=", it now shows the diff
>                                                                   ^^^^
> Same here.

Done.

>> +between the auto save file and the current file.
>> +                            (choices
>> +                             '(("yes" ?y "recover auto save file")
>> +                               ("no" ?n "don't recover auto save file")
>> +                               ("diff" ?= "diff auto save file with current file")))
>                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Maybe a better text would be
>
>    show changes between auto save file and current file

Thank you, that is indeed clear.  I have now changed the help text to
your suggestion.


[0001-Offer-to-show-diff-against-auto-save-in-recover-file.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52242; Package emacs. (Mon, 11 Dec 2023 04:16:02 GMT) Full text and rfc822 format available.

Message #24 received at 52242 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52242 <at> debbugs.gnu.org
Subject: Re: 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 part 1 (text/plain, inline)]
[ஞாயிறு டிசம்பர் 10, 2023] Visuwesh wrote:

Just noticed that I had an unrelated filling change sneak in, the
attached patch omits that.  Sorry for the noise.

[0001-Offer-to-show-diff-against-auto-save-in-recover-file.patch (text/x-diff, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 16 Dec 2023 12:38:01 GMT) Full text and rfc822 format available.

Notification sent to Visuwesh <visuwesh <at> tutanota.com>:
bug acknowledged by developer. (Sat, 16 Dec 2023 12:38:02 GMT) Full text and rfc822 format available.

Message #29 received at 52242-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 52242-done <at> debbugs.gnu.org
Subject: Re: bug#52242: 29.0.50; Feature Request: Offer to
 run`diff-buffer-with-file' in `recover-this-file' prompt
Date: Sat, 16 Dec 2023 14:36:33 +0200
> From: Visuwesh <visuweshm <at> gmail.com>
> Cc: 52242 <at> debbugs.gnu.org
> Date: Mon, 11 Dec 2023 09:44:50 +0530
> 
> [ஞாயிறு டிசம்பர் 10, 2023] Visuwesh wrote:
> 
> Just noticed that I had an unrelated filling change sneak in, the
> attached patch omits that.  Sorry for the noise.

Thanks, installed on the master branch, and closing the bug.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 16 Dec 2023 12:38:02 GMT) Full text and rfc822 format available.

Notification sent to Jean Louis <bugs <at> gnu.support>:
bug acknowledged by developer. (Sat, 16 Dec 2023 12:38:02 GMT) Full text and rfc822 format available.

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 16 Dec 2023 12:38:02 GMT) Full text and rfc822 format available.

Notification sent to Stefan Kangas <stefankangas <at> gmail.com>:
bug acknowledged by developer. (Sat, 16 Dec 2023 12:38:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 14 Jan 2024 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 102 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.