From 6f408bfaf9b3e83bdf553365f4c47c61421c9463 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 7 May 2021 00:17:37 +0100 Subject: that thing about docview not redisplaying with minibuffer active --- init.org | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/init.org b/init.org index f56037b..b8c02cf 100644 --- a/init.org +++ b/init.org @@ -1610,12 +1610,32 @@ doc-view-resolution 110 doc-view-continuous t doc-view-conversion-refresh-interval 1) + + :config + + ;; this is an ugly hack: when jao-minibuffer is active, + ;; somehow docview scrolling is not triggering a refresh, + ;; specially for scroll down movements, so we advice the + ;; scrolling functions to force a redisplay by going to + ;; another window. + + (defun jao--refresh (&rest _rest) + (let ((jao-minibuffer-enabled-p nil)) + (other-window 1) (other-window -1))) + + (dolist (f '(doc-view-scroll-up-or-next-page + doc-view-scroll-down-or-previous-page + doc-view-previous-line-or-previous-page + doc-view-next-line-or-next-page + image-eol + image-bol)) + (advice-add f :after #'jao--refresh)) + :bind (:map doc-view-mode-map ("j" . doc-view-next-line-or-next-page) - ("k" . doc-view-previous-line-or-previous-page)) - :custom ((mailcap-user-mime-data - '((doc-view-mode "application/pdf" jao-browse-doc-use-emacs-p) - ("zathura %s" "application/pdf"))))) + ("J" . doc-view-scroll-up-or-next-page) + ("k" . doc-view-previous-line-or-previous-page) + ("K" . doc-view-scroll-down-or-previous-page))) (use-package jao-doc-view :bind (:map doc-view-mode-map -- cgit v1.2.3