summaryrefslogtreecommitdiffhomepage
path: root/init.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-21 22:24:45 +0100
committerjao <jao@gnu.org>2022-09-21 22:28:04 +0100
commitfedeab4ab8a7a267072421535f852b350f42fb9d (patch)
treefa38547d47d191d4996b2553a96411fc5524ff64 /init.el
parent9e1754e8e2bc4fd3957df8e1d127f8e7e40dc70e (diff)
downloadelibs-fedeab4ab8a7a267072421535f852b350f42fb9d.tar.gz
elibs-fedeab4ab8a7a267072421535f852b350f42fb9d.tar.bz2
more clever open with zathura in doc/pdf-view
Diffstat (limited to 'init.el')
-rw-r--r--init.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/init.el b/init.el
index 30c3457..505af28 100644
--- a/init.el
+++ b/init.el
@@ -257,11 +257,11 @@
((mailcap-user-mime-data
`((jao-icalendar-import-buffer "application/ics")
("emacsclient -e '(jao-icalendar-import-invite \"%s\")'" "application/ics")
- (pdf-view-mode "application/pdf" (display-graphic-p))
+ (doc-view-mode "application/pdf" (display-graphic-p))
("zathura \"%s\"" "application/pdf")
- (image-mode "image/*" (display-graphic-p))
+ ;; (image-mode "image/*" (display-graphic-p))
("firefox %s && riverctl set-focused-tags 2" "text/html" jao-river-enabled)
- ("swayimg \"%s\"" "image/*": jao-sway-enabled)
+ ("swayimg \"%s\"" "image/*" jao-sway-enabled)
("imv-wayland \"%s\"" "image/*" jao-wayland-enabled)
("imv-x11 \"%s\"" "image/*")))))
@@ -1504,7 +1504,6 @@
;;;; pdf-tools
(use-package pdf-tools
- :disabled t
:ensure t
:demand t
:init
@@ -1611,10 +1610,13 @@
(interactive)
(jao-org-pdf-goto-org 4))
-(defun jao-doc-view-open-with-zathura ()
+(defun jao-open-with-zathura ()
(interactive)
- (when buffer-file-name
- (jao-zathura-open buffer-file-name (doc-view-current-page))))
+ (when-let (f buffer-file-name)
+ (let ((p (jao-doc-view-current-page)))
+ (cond (jao-river-enabled (jao-river-open-with-zathura f p))
+ (jao-sway-enabled (jao-sway-open-with-zathura f p))
+ (t (jao-zathura-open f p))))))
(jao-transient-major-mode doc-view
["Notes"
@@ -1632,7 +1634,7 @@
("S" "save session" jao-doc-session-save)
("d" "visit cache directory" doc-view-dired-cache)]
["External viewers"
- ("z" "open with zathura" jao-doc-view-open-with-zathura)])
+ ("z" "open with zathura" jao-open-with-zathura)])
(with-eval-after-load "pdf-view"
(jao-transient-major-mode pdf-view
@@ -1644,7 +1646,9 @@
("f" "forward jump" pdf-history-forward)]
["Session"
("s" "load session" jao-afio-open-pdf-session)
- ("S" "save session" jao-doc-session-save)]))
+ ("S" "save session" jao-doc-session-save)]
+ ["External viewers"
+ ("z" "open with zathura" jao-open-with-zathura)]))
;; (transient-get-suffix 'jao-transient-pdf-view '(0 -1))