diff options
author | William Carroll <wpcarro@gmail.com> | 2020-01-22T21·55+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-01-22T21·55+0000 |
commit | 857ef43d2de5aa318a3fe0bb55905294f890cede (patch) | |
tree | c79370940324578488fb61f7ebd4cd2faa434d59 /configs/shared/.emacs.d/wpc/bookmark.el | |
parent | 589349282f89643ffb8810e3b514d1323f6e39c8 (diff) |
Support bookmark/from-label
Add function to resolve a bookmark from its label.
Diffstat (limited to 'configs/shared/.emacs.d/wpc/bookmark.el')
-rw-r--r-- | configs/shared/.emacs.d/wpc/bookmark.el | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/configs/shared/.emacs.d/wpc/bookmark.el b/configs/shared/.emacs.d/wpc/bookmark.el index 7b28ec82710c..fb6eaf68ac30 100644 --- a/configs/shared/.emacs.d/wpc/bookmark.el +++ b/configs/shared/.emacs.d/wpc/bookmark.el @@ -68,6 +68,11 @@ Otherwise, open with `counsel-find-file'." :kbd "p")) "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)))))) + ;; TODO: Consider `ivy-read' extension that takes a list of structs, ;; `struct-to-label' and `label-struct' functions. @@ -93,11 +98,7 @@ Otherwise, open with `counsel-find-file'." (list/map #'bookmark-label)) :require-match t :action (lambda (label) - (->> bookmark/whitelist - (list/find - (lambda (b) - (equal label (bookmark-label b)))) - bookmark/open)))) + (bookmark/open (bookmark/from-label label))))) (when bookmark/install-kbds? (general-define-key |