diff options
author | bd <bdunahu@operationnull.com> | 2024-10-23 21:55:54 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2024-10-23 22:06:01 -0400 |
commit | 4df0aba0364f6a234870f0bf5e086b98609689a8 (patch) | |
tree | b751bf4813b177356a1f0b8c3eb4b6139466b380 /.config/emacs/modules/bd--files.el | |
parent | 566a8735c41dd4a4832faba9abf03aa93618c3af (diff) |
find-file opens pdfs/epub in zathura
Diffstat (limited to '.config/emacs/modules/bd--files.el')
-rw-r--r-- | .config/emacs/modules/bd--files.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/.config/emacs/modules/bd--files.el b/.config/emacs/modules/bd--files.el index 01f9f49..4765510 100644 --- a/.config/emacs/modules/bd--files.el +++ b/.config/emacs/modules/bd--files.el @@ -24,6 +24,21 @@ (,(regexp-opt '(".pdf")) "pdftotext -nopgbrk -enc UTF-8 -eol unix -layout") (,(regexp-opt '(".html")) "icecat &"))) +;; pdf +(defun bd/zathura (file &rest args) + "Launch zathura ignoring args." + (interactive) + (ignore args) + (start-process "zathura" nil "zathura" file)) + +(defun bd/pdf-find-file-wrapper (f &rest args) + "Wrapper around F (find-file), passing ARGS." + (if (string-match "\\(?:epub\\|pdf\\)" (or (file-name-extension (car args)) "")) + (progn + (bd/zathura (car args)) + (recentf-add-file (car args))) + (apply f args))) +(advice-add 'find-file :around #'bd/pdf-find-file-wrapper) ;;;; transmission (use-package transmission @@ -31,5 +46,6 @@ (:map transmission-mode-map ("R" . #'transmission-move))) + (provide 'bd--files) ;;; bd-files ends here |