Delete unused parts of bookmark.el
Trimming more fat.
This commit is contained in:
parent
8fef6c0408
commit
ea0788fd62
1 changed files with 1 additions and 44 deletions
|
@ -65,31 +65,6 @@ Otherwise, open with `counsel-find-file'."
|
||||||
:kbd "p"))
|
:kbd "p"))
|
||||||
"List of registered bookmarks.")
|
"List of registered bookmarks.")
|
||||||
|
|
||||||
(defun bookmark/from-label (label)
|
|
||||||
"Return the bookmark with LABEL or nil."
|
|
||||||
(->> 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)
|
|
||||||
(let ((labels (set/new "briefcase" "depot"))
|
|
||||||
(all-labels (->> bookmark/whitelist
|
|
||||||
(list/map (>> bookmark-label))
|
|
||||||
set/from-list)))
|
|
||||||
(prelude/assert (set/subset? labels all-labels))
|
|
||||||
(ivy-read "Repository: "
|
|
||||||
(set/to-list labels)
|
|
||||||
: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.
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; API
|
;; API
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -103,21 +78,7 @@ Otherwise, open with `counsel-find-file'."
|
||||||
((f-file? path)
|
((f-file? path)
|
||||||
(funcall bookmark/handle-file path)))))
|
(funcall bookmark/handle-file path)))))
|
||||||
|
|
||||||
(defun bookmark/ivy-open ()
|
|
||||||
"Use ivy to filter available bookmarks."
|
|
||||||
(interactive)
|
|
||||||
(ivy-read "Bookmark: "
|
|
||||||
(->> bookmark/whitelist
|
|
||||||
(list/map #'bookmark-label))
|
|
||||||
:require-match t
|
|
||||||
:action (lambda (label)
|
|
||||||
(bookmark/open (bookmark/from-label label)))))
|
|
||||||
|
|
||||||
(when bookmark/install-kbds?
|
(when bookmark/install-kbds?
|
||||||
(general-define-key
|
|
||||||
:prefix "<SPC>"
|
|
||||||
:states '(normal)
|
|
||||||
"jj" #'bookmark/ivy-open)
|
|
||||||
(->> bookmark/whitelist
|
(->> bookmark/whitelist
|
||||||
(list/map
|
(list/map
|
||||||
(lambda (b)
|
(lambda (b)
|
||||||
|
@ -127,11 +88,7 @@ Otherwise, open with `counsel-find-file'."
|
||||||
(string/concat "j" (bookmark-kbd b))
|
(string/concat "j" (bookmark-kbd b))
|
||||||
;; TODO: Consider `cl-labels' so `which-key' minibuffer is more
|
;; TODO: Consider `cl-labels' so `which-key' minibuffer is more
|
||||||
;; helpful.
|
;; helpful.
|
||||||
(lambda () (interactive) (bookmark/open b))))))
|
(lambda () (interactive) (bookmark/open b)))))))
|
||||||
(general-define-key
|
|
||||||
:states '(normal)
|
|
||||||
:prefix "<SPC>"
|
|
||||||
"gS" #'bookmark/magit-status))
|
|
||||||
|
|
||||||
(provide 'bookmark)
|
(provide 'bookmark)
|
||||||
;;; bookmark.el ends here
|
;;; bookmark.el ends here
|
||||||
|
|
Loading…
Reference in a new issue