Subject: Re: bug#23671: 25.0.94; recover-this-file error

From: Glenn Morris <[email-masked]>
Date: Wed, 01 Mar 2017 18:31:14 -0500

Version: 26.1

Live System User wrote:

> I saw a message from Emacs that I could recover a file. I switched to
> another buffer to check out something but didn't switch back when I
> invoked `recover-this-file' and got the error:
>
>              Wrong type argument: stringp, nil

commit 8244357
Date:   Wed Mar 1 18:29:48 2017 -0500

    Small recover-this-file improvement
    
    * lisp/files.el (recover-this-file): Explicit error if not
    visiting a file.  (Bug#23671)

diff --git a/lisp/files.el b/lisp/files.el
index 7c9271e..c7de445 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5838,6 +5838,8 @@ an auto-save file."
 (defun recover-this-file ()
   "Recover the visited file--get contents from its last auto-save file."
   (interactive)
+  (or buffer-file-name
+      (user-error "This buffer is not visiting a file"))
   (recover-file buffer-file-name))
 
 (defun recover-file (file)