about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-01-06T22·08-0800
committerwpcarro <wpcarro@gmail.com>2022-01-08T06·23+0000
commit7c558f7c53eb882c04dc9a046476c58b29e60f0a (patch)
treeea5685b6b2bf2490cf0dd5a98e3cd99ad1f16e45
parenta21da10b1650d22cb546e286b14a921b6bce0846 (diff)
fix(wpcarro/emacs): Redefine bookmark-install-kbd as public fn r/3570
I originally refactored this by inlining it as a lambda function, but I was
ignoring the fact that my work machines relied on it because I have Elisp code
in google-briefcase that calls `bookmark-install-kbd`.

Change-Id: I03804250fdfdc22be1445718a061a46461eb9af8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4820
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/bookmark.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/bookmark.el b/users/wpcarro/emacs/.emacs.d/wpc/bookmark.el
index c5e3bf3ac965..04efc7c2e505 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/bookmark.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/bookmark.el
@@ -80,6 +80,14 @@
    (format "J%s" (bookmark-kbd b)) `,(intern (format "bookmark-visit-%s" (bookmark-label b)))
    (format "j%s" (bookmark-kbd b)) `,(intern (format "bookmark-browse-%s" (bookmark-label b)))))
 
+(defun bookmark-install-kbd (x)
+  "Install the keybindings for a bookmark, X."
+  (general-define-key
+    :prefix "<SPC>"
+    :states '(normal)
+    (format "J%s" (bookmark-kbd x)) (lambda () (interactive) (find-file (bookmark-path x)))
+    (format "j%s" (bookmark-kbd x)) (lambda () (interactive) (bookmark-open (bookmark-path x)))))
+
 (defun bookmark-install-kbds ()
   "Install the keybindings defined herein."
   (->> bookmark-whitelist