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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 09 Dec 2023 11:33:18 +0200

> From: Visuwesh <[email-masked]>
> 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.