about summary refs log tree commit diff
path: root/configs/shared/.emacs.d/wpc/bookmark.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-01-22T21·55+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-01-22T21·55+0000
commit1a2ae5499eee1ea3a53ff01155f67d80d40897eb (patch)
tree850254c23ac35b55684b899d70242874cba4282a /configs/shared/.emacs.d/wpc/bookmark.el
parent857ef43d2de5aa318a3fe0bb55905294f890cede (diff)
Support bookmark/magit-status
Add function to quickly get `magit-status` buffers for some repositories in
which I spend time.
Diffstat (limited to 'configs/shared/.emacs.d/wpc/bookmark.el')
-rw-r--r--configs/shared/.emacs.d/wpc/bookmark.el17
1 files changed, 16 insertions, 1 deletions
diff --git a/configs/shared/.emacs.d/wpc/bookmark.el b/configs/shared/.emacs.d/wpc/bookmark.el
index fb6eaf68ac30..d8efdba8af05 100644
--- a/configs/shared/.emacs.d/wpc/bookmark.el
+++ b/configs/shared/.emacs.d/wpc/bookmark.el
@@ -73,6 +73,17 @@ Otherwise, open with `counsel-find-file'."
   (->> bookmark/whitelist
        (list/find (lambda (b) (equal label (bookmark-label b))))))
 
+(defun bookmark/magit-status ()
+  "Use ivy to select a bookmark and jump to its `magit-status' buffer."
+  (interactive)
+  (ivy-read "Repository: "
+            '("dotfiles" "mono" "tazjins-depot")
+            :require-match t
+            :action (lambda (label)
+                      (->> label
+                           bookmark/from-label
+                           bookmark-path
+                           magit-status))))
 
 ;; TODO: Consider `ivy-read' extension that takes a list of structs,
 ;; `struct-to-label' and `label-struct' functions.
@@ -114,7 +125,11 @@ Otherwise, open with `counsel-find-file'."
            (string/concat "j" (bookmark-kbd b))
            ;; TODO: Consider `cl-labels' so `which-key' minibuffer is more
            ;; helpful.
-           (lambda () (interactive) (bookmark/open b)))))))
+           (lambda () (interactive) (bookmark/open b))))))
+  (general-define-key
+   :states '(normal)
+   :prefix "<SPC>"
+   "gS" #'bookmark/magit-status))
 
 (provide 'bookmark)
 ;;; bookmark.el ends here