doc-view: separate DPI up (C-c h) / down (C-c l)

This commit is contained in:
2026-09-10 12:49:37 -04:00
parent edb61931ee
commit 8778459b57
2 changed files with 26 additions and 6 deletions

View File

@@ -2898,16 +2898,26 @@ Same page navigation as PDF-Tools (C-j / C-k) for doc-view buffers (renders .doc
:n "C-j" #'doc-view-next-page :n "C-j" #'doc-view-next-page
:n "C-k" #'doc-view-previous-page) :n "C-k" #'doc-view-previous-page)
;; Cycle render DPI 100 -> 200 -> 300 -> 100, re-rasterize this buffer (C-c h) ;; Render DPI up (C-c h) / down (C-c l), re-rasterize this buffer on demand
(defun gortium/docview-toggle-res () (defun gortium/docview-res-up ()
(interactive) (interactive)
(let ((new (cond ((< doc-view-resolution 150) 200) (let ((new (cond ((< doc-view-resolution 150) 200)
((< doc-view-resolution 250) 300) ((< doc-view-resolution 250) 300)
(t 300))))
(setq-local doc-view-resolution new)
(doc-view-reconvert-doc)
(message "doc-view @ %s dpi" new)))
(defun gortium/docview-res-down ()
(interactive)
(let ((new (cond ((>= doc-view-resolution 250) 200)
((>= doc-view-resolution 150) 100)
(t 100)))) (t 100))))
(setq-local doc-view-resolution new) (setq-local doc-view-resolution new)
(doc-view-reconvert-doc) (doc-view-reconvert-doc)
(message "doc-view @ %s dpi" new))) (message "doc-view @ %s dpi" new)))
(map! :map doc-view-mode-map :n "C-c h" #'gortium/docview-toggle-res)) (map! :map doc-view-mode-map
:n "C-c h" #'gortium/docview-res-up
:n "C-c l" #'gortium/docview-res-down))
#+end_src #+end_src
* Custom functions * Custom functions

View File

@@ -1999,16 +1999,26 @@ only injects when the project's context-tag matches current mu4e context."
:n "C-j" #'doc-view-next-page :n "C-j" #'doc-view-next-page
:n "C-k" #'doc-view-previous-page) :n "C-k" #'doc-view-previous-page)
;; Cycle render DPI 100 -> 200 -> 300 -> 100, re-rasterize this buffer (C-c h) ;; Render DPI up (C-c h) / down (C-c l), re-rasterize this buffer on demand
(defun gortium/docview-toggle-res () (defun gortium/docview-res-up ()
(interactive) (interactive)
(let ((new (cond ((< doc-view-resolution 150) 200) (let ((new (cond ((< doc-view-resolution 150) 200)
((< doc-view-resolution 250) 300) ((< doc-view-resolution 250) 300)
(t 300))))
(setq-local doc-view-resolution new)
(doc-view-reconvert-doc)
(message "doc-view @ %s dpi" new)))
(defun gortium/docview-res-down ()
(interactive)
(let ((new (cond ((>= doc-view-resolution 250) 200)
((>= doc-view-resolution 150) 100)
(t 100)))) (t 100))))
(setq-local doc-view-resolution new) (setq-local doc-view-resolution new)
(doc-view-reconvert-doc) (doc-view-reconvert-doc)
(message "doc-view @ %s dpi" new))) (message "doc-view @ %s dpi" new)))
(map! :map doc-view-mode-map :n "C-c h" #'gortium/docview-toggle-res)) (map! :map doc-view-mode-map
:n "C-c h" #'gortium/docview-res-up
:n "C-c l" #'gortium/docview-res-down))
;;Refile in datetree function ;;Refile in datetree function
(defun org-refile-to-datetree (&optional file) (defun org-refile-to-datetree (&optional file)