From: Tassilo Horn Date: Fri, 25 Oct 2019 20:07:39 +0000 (+0200) Subject: Adapt doc-view to latest image-mode changes X-Git-Tag: emacs-27.0.90~892 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a0f7ea599919f967331173fdde2b87e50c88c4b7;p=emacs.git Adapt doc-view to latest image-mode changes The functions image-scroll-down, image-scroll-up, image-next-line, and image-previous-line now return pixel values instead of multiples of character height as of commit 9c66b09950. * lisp/doc-view.el (doc-view-scroll-up-or-next-page): (doc-view-scroll-down-or-previous-page): (doc-view-next-line-or-next-page): (doc-view-previous-line-or-previous-page): (doc-view-insert-image): Adapt to image-scroll-up/down and image-next/previous-line now returning pixel values instead of multiples of character heights. Fixes bug#37874. --- diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 1fbaebd6266..d88150735fe 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -598,7 +598,7 @@ Otherwise, goto next page only on typing SPC (ARG is nil)." (if (or doc-view-continuous (null arg)) (let ((hscroll (window-hscroll)) (cur-page (doc-view-current-page))) - (when (= (window-vscroll) (image-scroll-up arg)) + (when (= (window-vscroll nil t) (image-scroll-up arg)) (doc-view-next-page) (when (/= cur-page (doc-view-current-page)) (image-bob) @@ -615,7 +615,7 @@ Otherwise, goto previous page only on typing DEL (ARG is nil)." (if (or doc-view-continuous (null arg)) (let ((hscroll (window-hscroll)) (cur-page (doc-view-current-page))) - (when (= (window-vscroll) (image-scroll-down arg)) + (when (= (window-vscroll nil t) (image-scroll-down arg)) (doc-view-previous-page) (when (/= cur-page (doc-view-current-page)) (image-eob) @@ -631,7 +631,7 @@ at the bottom edge of the page moves to the next page." (if doc-view-continuous (let ((hscroll (window-hscroll)) (cur-page (doc-view-current-page))) - (when (= (window-vscroll) (image-next-line arg)) + (when (= (window-vscroll nil t) (image-next-line arg)) (doc-view-next-page) (when (/= cur-page (doc-view-current-page)) (image-bob) @@ -647,7 +647,7 @@ at the top edge of the page moves to the previous page." (if doc-view-continuous (let ((hscroll (window-hscroll)) (cur-page (doc-view-current-page))) - (when (= (window-vscroll) (image-previous-line arg)) + (when (= (window-vscroll nil t) (image-previous-line arg)) (doc-view-previous-page) (when (/= cur-page (doc-view-current-page)) (image-eob) @@ -1429,7 +1429,7 @@ ARGS is a list of image descriptors." (vscroll (image-mode-window-get 'vscroll win))) ;; Reset scroll settings, in case they were changed. (if hscroll (set-window-hscroll win hscroll)) - (if vscroll (set-window-vscroll win vscroll))))))))) + (if vscroll (set-window-vscroll win vscroll t))))))))) (defun doc-view-sort (a b) "Return non-nil if A should be sorted before B.