diff options
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 |