diff options
author | jao <jao@gnu.org> | 2022-09-21 22:24:45 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-09-21 22:28:04 +0100 |
commit | fedeab4ab8a7a267072421535f852b350f42fb9d (patch) | |
tree | fa38547d47d191d4996b2553a96411fc5524ff64 | |
parent | 9e1754e8e2bc4fd3957df8e1d127f8e7e40dc70e (diff) | |
download | elibs-fedeab4ab8a7a267072421535f852b350f42fb9d.tar.gz elibs-fedeab4ab8a7a267072421535f852b350f42fb9d.tar.bz2 |
more clever open with zathura in doc/pdf-view
-rw-r--r-- | init.el | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -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)) |