GNU bug report logs - #26996
25.1; doc-view-revert-buffer doesn't detect file change while using tramp

Previous Next

Package: emacs;

Reported by: Iakov Davydov <dav02.davs <at> myths.ru>

Date: Fri, 19 May 2017 15:08:01 UTC

Severity: minor

Tags: fixed

Found in version 25.1

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Iakov Davydov <dav02.davs <at> myths.ru>, 26996 <at> debbugs.gnu.org
Subject: Re: bug#26996: 25.1; doc-view-revert-buffer doesn't detect file
 change while using tramp
Date: Fri, 01 Nov 2019 16:07:15 -0400
>> I have problem with reverting buffer when opening pdf via tramp. 
>> This happens in emacs 24 and emacs 25, with different version of tramp. 
>>
>> Steps to reproduce are like this: 
>> 1. Open pdf with tramp over ssh -> DocView mode. 
>> 2. Update the pdf somehow on the server. 
>> 3. Press 'g' to revert buffer (doc-view-revert-buffer) -> "yes". 
>>
>> If the pdf was updated, I expect to see an updated pdf. Instead I see an 
>> old pdf. 
>
> I managed to reproduce this in Emacs 27, and it should now be fixed.

Hmm... but now auto-revert loops forever:
updating the file -> triggers auto-revert -> your new code
saves the buffer to the file -> triggers auto-revert -> ...

I think the patch below is needed.

But I wonder why you added:

    (doc-view-make-safe-dir doc-view-cache-directory)

did it just seemed safer or have you found a concrete case that
needed it?


        Stefan


diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 5f9d4fcc2f..457e4325cf 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -457,9 +457,11 @@ doc-view--revert-buffer
                         (apply orig-fun args)
                         ;; Update the cached version of the pdf file,
                         ;; too.  This is the one that's used when
-                        ;; rendering.
-                        (doc-view-make-safe-dir doc-view-cache-directory)
-                        (write-region nil nil doc-view--buffer-file-name))))
+                        ;; rendering (bug#26996).
+                        (unless (equal buffer-file-name
+                                       doc-view--buffer-file-name)
+                          (doc-view-make-safe-dir doc-view-cache-directory)
+                          (write-region nil nil doc-view--buffer-file-name)))))
     (if (and (eq 'pdf doc-view-doc-type)
              (executable-find "pdfinfo"))
         ;; We don't want to revert if the PDF file is corrupted which






This bug report was last modified 5 years and 202 days ago.

Previous Next


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