bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while


From: Stefan Monnier
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]