From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Iakov Davydov <dav02.davs@myths.ru>, 26996@debbugs.gnu.org
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 [thread overview]
Message-ID: <jwvtv7ns6rs.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87sgofl0me.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 29 Sep 2019 14:59:05 +0200")
>> 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
next prev parent reply other threads:[~2019-11-01 20:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 12:35 bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp Iakov Davydov
2019-09-29 12:59 ` Lars Ingebrigtsen
2019-11-01 20:07 ` Stefan Monnier [this message]
2019-11-02 14:56 ` Lars Ingebrigtsen
2019-11-02 14:58 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvtv7ns6rs.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=26996@debbugs.gnu.org \
--cc=dav02.davs@myths.ru \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).