[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/doc-view.el,v
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/doc-view.el,v |
Date: |
Tue, 12 Feb 2008 02:41:57 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 08/02/12 02:41:57
Index: doc-view.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/doc-view.el,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- doc-view.el 10 Feb 2008 03:06:54 -0000 1.44
+++ doc-view.el 12 Feb 2008 02:41:54 -0000 1.45
@@ -551,7 +551,7 @@
(cancel-timer doc-view-current-timer)
(setq doc-view-current-timer nil))
;; Yippie, finished. Update the display!
- (doc-view-display buffer-file-name 'force))))
+ (doc-view-display (current-buffer) 'force))))
(defun doc-view-pdf/ps->png (pdf-ps png)
"Convert PDF-PS to PNG asynchronously."
@@ -575,7 +575,7 @@
(setq doc-view-current-timer
(run-at-time "1 secs" doc-view-conversion-refresh-interval
'doc-view-display
- buffer-file-name))))
+ (current-buffer)))))
(defun doc-view-pdf->txt-sentinel (proc event)
(if (not (string-match "finished" event))
@@ -731,11 +731,11 @@
(and (= (length a) (length b))
(string< a b))))
-(defun doc-view-display (doc &optional force)
- "Start viewing the document DOC.
+(defun doc-view-display (buffer &optional force)
+ "Start viewing the document in BUFFER.
If FORCE is non-nil, start viewing even if the document does not
have the page we want to view."
- (with-current-buffer (get-file-buffer doc)
+ (with-current-buffer buffer
(setq doc-view-current-files
(sort (directory-files (doc-view-current-cache-dir) t
"page-[0-9]+\\.png" t)
@@ -778,7 +778,7 @@
(progn
(doc-view-kill-proc)
(setq buffer-read-only nil)
- (delete-overlay doc-view-current-overlay)
+ (remove-overlays (point-min) (point-max) 'doc-view)
;; Switch to the previously used major mode or fall back to fundamental
;; mode.
(if doc-view-previous-major-mode
@@ -926,7 +926,7 @@
(if (file-exists-p (doc-view-current-cache-dir))
(progn
(message "DocView: using cached files!")
- (doc-view-display buffer-file-name 'force))
+ (doc-view-display (current-buffer) 'force))
(doc-view-convert-current-doc))
(message
"%s"
@@ -942,6 +942,24 @@
(defvar bookmark-make-cell-function)
+(defun doc-view-clone-buffer-hook ()
+ ;; FIXME: There are several potential problems linked with reconversion
+ ;; and auto-revert when we have indirect buffers because they share their
+ ;; /tmp cache directory. This sharing is good (you'd rather not reconvert
+ ;; for each clone), but that means that clones need to collaborate a bit.
+ ;; I guess it mostly means: detect when a reconversion process is already
+ ;; running, and run the sentinel in all clones.
+ ;; Not sure how important it is to fix it: a better target would be to
+ ;; allow a single buffer (without cloning) to display different pages in
+ ;; different windows.
+ ;; Maybe then the clones should really have a separate /tmp directory
+ ;; so they could have a different resolution and you could use clones
+ ;; for zooming.
+ (dolist (ol (overlays-in (point-min) (point-max)))
+ ;; The overlay was copied by the cloning, so we just need to find it
+ ;; and put it in doc-view-current-overlay.
+ (if (overlay-get ol 'doc-view) (setq doc-view-current-overlay ol))))
+
;;;###autoload
(defun doc-view-mode ()
"Major mode in DocView buffers.
@@ -988,9 +1006,11 @@
(make-local-variable 'doc-view-current-search-matches)
(set (make-local-variable 'doc-view-current-overlay)
(make-overlay (point-min) (point-max) nil t))
+ (overlay-put doc-view-current-overlay 'doc-view t)
(add-hook 'change-major-mode-hook
- (lambda () (delete-overlay doc-view-current-overlay))
+ (lambda () (remove-overlays (point-min) (point-max) 'doc-view))
nil t)
+ (add-hook 'clone-indirect-buffer-hook 'doc-view-clone-buffer-hook nil t)
;; Keep track of [vh]scroll when switching buffers
(make-local-variable 'image-mode-current-hscroll)
- [Emacs-diffs] Changes to emacs/lisp/doc-view.el,v, Stefan Monnier, 2008/02/09
- [Emacs-diffs] Changes to emacs/lisp/doc-view.el,v,
Stefan Monnier <=
- [Emacs-diffs] Changes to emacs/lisp/doc-view.el,v, Stefan Monnier, 2008/02/20
- [Emacs-diffs] Changes to emacs/lisp/doc-view.el,v, Stefan Monnier, 2008/02/25
- [Emacs-diffs] Changes to emacs/lisp/doc-view.el,v, Stefan Monnier, 2008/02/25