summaryrefslogtreecommitdiff
path: root/.config/emacs
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-03 23:32:21 -0500
committerbd <bdunahu@operationnull.com>2025-03-03 23:32:21 -0500
commit42de6d457f9c47b76e26a53055d0dfe026f94bd6 (patch)
tree1a6d3c873e7e97b39025cac4efbcabc4889f9e63 /.config/emacs
parent606b02f3c659fc00470beb3c526e646a38ecf55d (diff)
Selector functions for displaying a directory of web documentation
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/modules/bd--devel.el27
-rw-r--r--.config/emacs/modules/bd--exwm.el3
-rw-r--r--.config/emacs/modules/bd--files.el3
3 files changed, 31 insertions, 2 deletions
diff --git a/.config/emacs/modules/bd--devel.el b/.config/emacs/modules/bd--devel.el
index d023223..e846a93 100644
--- a/.config/emacs/modules/bd--devel.el
+++ b/.config/emacs/modules/bd--devel.el
@@ -116,6 +116,33 @@
(require 'geiser-mode)
(require 'geiser-guile)
+(defcustom doc-dirs '()
+ "Defines a buffer-local list of directories to find
+documentation."
+ :type 'list
+ :group 'docs
+ :safe 'listp
+ :local t)
+
+(defun bd/selector-doc (dir)
+ "List all HTML files in a directory (recursive), and
+display for opening with browser."
+ (selector-source-create
+ dir
+ :candidates
+ (-map
+ (lambda (d) (selector-candidate-create (file-relative-name d dir) :value d))
+ (directory-files-recursively dir ".html"))
+ :actions
+ (list (lambda (x) (eww-open-file x)))))
+
+(defun bd/doc-finder ()
+ (interactive)
+ (unwind-protect
+ (selector
+ (append (-map (lambda (x) (bd/selector-doc x)) doc-dirs)
+ (list (bd/selector-search))))))
+
(use-package eglot
:defer t
:hook ((c-mode . eglot-ensure)
diff --git a/.config/emacs/modules/bd--exwm.el b/.config/emacs/modules/bd--exwm.el
index 8a4e086..cb59a8c 100644
--- a/.config/emacs/modules/bd--exwm.el
+++ b/.config/emacs/modules/bd--exwm.el
@@ -47,11 +47,12 @@ that buffer."
([f10] . emms-next)
([print] . bd/shoot-part)
([S-print] . bd/shoot-full)
+ ([?\s-I] . bd/doc-finder)
([?\s-O] . bd/browse-dispatcher)
([?\s-P] . bd/password)
([?\s-r] . exwm-reset)
([?\s-d] . toggle-window-dedicated)
- ([?\s-q] . kill-buffer-and-window)
+ ([?\s-q] . kill-current-buffer)
([?\s-x] . (lambda (command)
(interactive (list (read-shell-command "s-x ")))
(start-process-shell-command command nil command))))
diff --git a/.config/emacs/modules/bd--files.el b/.config/emacs/modules/bd--files.el
index 5cf4e86..06a113a 100644
--- a/.config/emacs/modules/bd--files.el
+++ b/.config/emacs/modules/bd--files.el
@@ -34,6 +34,7 @@
(cdr (assoc (file-name-extension file)
'(("gba" . "mgba")
("z64" . "mupen64plus")
+ ("iso" . "dolphin-emu")
("n64" . "mupen64plus")
("sfc" . "bsnes"))))))
(start-process command nil command (expand-file-name file))))
@@ -57,7 +58,7 @@
(bd/open-with-function #'bd/nsxiv))
((string-match (regexp-opt '("qcow2")) ext)
(bd/open-with-function #'bd/qemu))
- ((string-match (regexp-opt '("gba" "z64" "n64" "sfc")) ext)
+ ((string-match (regexp-opt '("gba" "z64" "n64" "sfc" "iso")) ext)
(bd/open-with-function #'bd/rom))
(t (apply f args)))))
(advice-add #'find-file :around #'bd/external-find-file-wrapper)