aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/doc-view.el29
1 files changed, 23 insertions, 6 deletions
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 2fdcc111cab..9cc55529440 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -591,11 +591,15 @@ Typically \"page-%s.png\".")
591 (cl-labels ((revert () 591 (cl-labels ((revert ()
592 (let ((revert-buffer-preserve-modes t)) 592 (let ((revert-buffer-preserve-modes t))
593 (apply orig-fun args) 593 (apply orig-fun args)
594 ;; Update the cached version of the pdf file, 594 ;; Update the cached version of the pdf file, too.
595 ;; too. This is the one that's used when 595 ;; This is the one that's used when rendering
596 ;; rendering (bug#26996). 596 ;; (bug#26996). doc-view--buffer-file-name is nil in
597 (unless (equal buffer-file-name 597 ;; the case where we've switched to the editing mode
598 doc-view--buffer-file-name) 598 ;; (bug#76478). In that case, we'll update the cached
599 ;; version when switching back to doc-view-mode.
600 (when (and doc-view--buffer-file-name
601 (not (equal buffer-file-name
602 doc-view--buffer-file-name)))
599 ;; FIXME: Lars says he needed to recreate 603 ;; FIXME: Lars says he needed to recreate
600 ;; the dir, we should figure out why. 604 ;; the dir, we should figure out why.
601 (doc-view-make-safe-dir doc-view-cache-directory) 605 (doc-view-make-safe-dir doc-view-cache-directory)
@@ -2443,7 +2447,20 @@ to the next best mode."
2443See the command `doc-view-mode' for more information on this mode." 2447See the command `doc-view-mode' for more information on this mode."
2444 :lighter " DocView" 2448 :lighter " DocView"
2445 (when doc-view-minor-mode 2449 (when doc-view-minor-mode
2446 (add-hook 'change-major-mode-hook (lambda () (doc-view-minor-mode -1)) nil t) 2450 (add-hook 'change-major-mode-hook
2451 (lambda ()
2452 (doc-view-minor-mode -1))
2453 nil t)
2454 ;; OpenDocuments are archive files, so their editing mode is
2455 ;; archive-mode. When editing and saving a file in that archive,
2456 ;; it'll automatically revert the archive buffer. Take care to
2457 ;; re-enable `doc-view-minor-mode' in that case.
2458 (add-hook 'revert-buffer-restore-functions
2459 (lambda ()
2460 (lambda ()
2461 (unless (derived-mode-p 'doc-view-mode)
2462 (doc-view-minor-mode 1))))
2463 nil t)
2447 (message 2464 (message
2448 "%s" 2465 "%s"
2449 (substitute-command-keys 2466 (substitute-command-keys