summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/bd--files.el
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2024-10-25 19:31:40 -0400
committerbd <bdunahu@operationnull.com>2024-10-25 19:31:40 -0400
commitb61259b49f7349fe705df4ab77d37d317bebbcaf (patch)
treec032034150f9fd71c4dbf420c651d9c30dfc0cb5 /.config/emacs/modules/bd--files.el
parentea04c1f4317cff446d6a4753072329f6bc9b627a (diff)
dunst, miscellaneous changes
Diffstat (limited to '.config/emacs/modules/bd--files.el')
-rw-r--r--.config/emacs/modules/bd--files.el18
1 files changed, 9 insertions, 9 deletions
diff --git a/.config/emacs/modules/bd--files.el b/.config/emacs/modules/bd--files.el
index e5df266..b8a5f4a 100644
--- a/.config/emacs/modules/bd--files.el
+++ b/.config/emacs/modules/bd--files.el
@@ -3,14 +3,10 @@
;;; Code:
-(defun bd/file-has-extension? (file types)
- "Returns t if file has an extension in LST, nil otherwise."
- (string-match (regexp-opt lst) (or (file-name-extension file) "")))
-
(defmacro bd/defun-find-file-wrapper (name types open-f)
`(defun ,name (f &rest args)
"Wrapper around F (find-file), passing ARGS."
- (if (bd/file-has-extension? (car args) ,types)
+ (if (string-match (regexp-opt ,types) (or (file-name-extension (car args)) ""))
(progn
(,(eval open-f) (car args))
(recentf-add-file (car args))
@@ -33,8 +29,7 @@
dired-dwim-target t
dired-guess-shell-alist-user
- `((,(regexp-opt '(".jpeg" ".jpg" ".png")) "nsxiv &")
- (,(regexp-opt '(".pdf")) "pdftotext -nopgbrk -enc UTF-8 -eol unix -layout")
+ `((,(regexp-opt '(".pdf")) "pdftotext -nopgbrk -enc UTF-8 -eol unix -layout")
(,(regexp-opt '(".html")) "icecat &")))
;; pdf
@@ -43,7 +38,9 @@
(interactive)
(start-process (concat "zathura (" (file-name-base file) ")") nil "zathura" (expand-file-name file)))
-(bd/defun-find-file-wrapper bd/pdf-find-file-wrapper '("epub" "pdf") #'bd/zathura)
+(bd/defun-find-file-wrapper bd/pdf-find-file-wrapper
+ '("epub" "pdf")
+ #'bd/zathura)
(advice-add 'find-file :around #'bd/pdf-find-file-wrapper)
;; video
@@ -61,9 +58,12 @@
(defun bd/nsxiv (file)
"Open FILE with nsxiv"
(start-process (concat "nsxiv (" (file-name-base file) ")") nil "nsxiv" (expand-file-name file)))
-(bd/defun-find-file-wrapper bd/image-find-file-wrapper '("jpg" "jpeg" "png" "webp" "bmp" "ico" "gif" "JPG" "PNG") #'bd/nsxiv)
+(bd/defun-find-file-wrapper bd/image-find-file-wrapper
+ '("jpg" "jpeg" "png" "webp" "bmp" "ico" "gif" "JPG" "PNG")
+ #'bd/nsxiv)
(advice-add 'find-file :around 'bd/image-find-file-wrapper)
+
;;;; transmission
(use-package transmission
:bind