summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/bd--files.el
diff options
context:
space:
mode:
Diffstat (limited to '.config/emacs/modules/bd--files.el')
-rw-r--r--.config/emacs/modules/bd--files.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/.config/emacs/modules/bd--files.el b/.config/emacs/modules/bd--files.el
index f050132..ab6c56a 100644
--- a/.config/emacs/modules/bd--files.el
+++ b/.config/emacs/modules/bd--files.el
@@ -20,6 +20,15 @@
(defun bd/nsxiv (file)
"Open FILE with nsxiv."
(start-process "nsxiv" nil "nsxiv" (expand-file-name file)))
+(defun bd/rom (file)
+ "Open FILE with an emulator."
+ (let ((command
+ (cdr (assoc (file-name-extension file)
+ '(("gba" . "mgba")
+ ("z64" . "mupen64plus")
+ ("n64" . "mupen64plus")
+ ("sfc" . "bsnes"))))))
+ (start-process command nil command (expand-file-name file))))
(defun bd/external-find-file-wrapper (f &rest args)
"Wrapper around F (find-file), passing ARGS."
@@ -37,6 +46,8 @@
((string-match (regexp-opt '("jpg" "jpeg" "png" "webp"
"ico" "gif" "JPG" "PNG")) ext)
(runner #'bd/nsxiv))
+ ((string-match (regexp-opt '("gba" "z64" "n64" "sfc")) ext)
+ (runner #'bd/rom))
(t (apply f args)))))
(advice-add 'find-file :around #'bd/external-find-file-wrapper)