From 1a2ae5499eee1ea3a53ff01155f67d80d40897eb Mon Sep 17 00:00:00 2001 From: William Carroll Date: Wed, 22 Jan 2020 21:55:33 +0000 Subject: Support bookmark/magit-status Add function to quickly get `magit-status` buffers for some repositories in which I spend time. --- configs/shared/.emacs.d/wpc/bookmark.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'configs/shared/.emacs.d/wpc') 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 "" + "gS" #'bookmark/magit-status)) (provide 'bookmark) ;;; bookmark.el ends here -- cgit 1.4.1