diff options
Diffstat (limited to 'custom')
| -rw-r--r-- | custom/jao-custom-gnus.el | 13 | ||||
| -rw-r--r-- | custom/jao-custom-pdf.el | 40 |
2 files changed, 52 insertions, 1 deletions
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index dad3de1..7e7172b 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -825,3 +825,16 @@ (jao-when-darwin (define-key gnus-group-mode-map "O" 'jao-mac-open-nnw)) + +(with-eval-after-load "consult-notmuch" + (defun jao-notmuch-gnus--open-candidate (candidate) + "Open a notmuch-search completion candidate email in Gnus." + (message "candidate: %S" candidate) + (jao-notmuch-gnus-goto-message (consult-notmuch--candidate-id candidate))) + + (defun jao-gnus-consult-notmuch () + "Run a consult-notmuch query that opens candidates in Gnus." + (interactive) + (jao-notmuch-gnus--open-candidate (consult-notmuch--search))) + + (consult-customize jao-gnus-consult-notmuch :preview-key 'any)) diff --git a/custom/jao-custom-pdf.el b/custom/jao-custom-pdf.el index 50612bf..e82873f 100644 --- a/custom/jao-custom-pdf.el +++ b/custom/jao-custom-pdf.el @@ -1,6 +1,42 @@ ;; -*- lexical-binding: t -*- ;;;; open pdfs +(defun jao-find-or-open (file &optional page height) + (cond ((and jao-pdf-open-in-emacs window-system) + (let* ((buffs (buffer-list)) + (b (catch 'done + (while buffs + (when (string-equal (buffer-file-name (car buffs)) file) + (throw 'done (car buffs))) + (setq buffs (cdr buffs)))))) + (jao-afio-goto-docs) + (if b (pop-to-buffer b) (find-file file)) + (when page (jao-doc-view-goto-page page height)))) + (jao-river-enabled (jao-river-open-with-zathura file page)) + (jao-sway-enabled (jao-sway-open-with-zathura file page)) + ((eq system-type 'darwin) (jao-mac-open-in-skim file page)) + (t (jao-zathura-open file page)))) + +(defun jao-open-with-zathura () + (interactive) + (jao-when-linux + (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))))))) + +(defun jao-zathura-open (file page) + (jao-when-linux + (let ((id (jao-x11-search-window (jao-pdf-zathura-title-rx file)))) + (if (string-blank-p id) + (progn + (when jao-xmonad-enabled (jao-x11-goto-ws 2)) + (jao-shell-exec (jao-pdf-zathura-open-cmd file page))) + (let* ((page (if page (format " && xdotool type %dg" page) "")) + (cmd (format "xdotool windowactivate %s%s" id page))) + (jao-shell-exec cmd t)))))) + (use-package saveplace-pdf-view :ensure t :demand t @@ -8,9 +44,11 @@ (use-package jao-pdf :demand t + :after jao-custom-org :config (setq jao-open-doc-fun 'jao-find-or-open) - (setq jao-org-open-pdf-fun jao-open-doc-fun)) + (setq jao-org-open-pdf-fun jao-open-doc-fun) + (setq jao-pdf-org-dir jao-org-dir)) ;;;; doc-view (use-package doc-view |
