branch: master
commit c8be3973a4841a3ee7d05e59666724965ecc8dd8
Author: Bryan Gilbert <[email protected]>
Commit: Bryan Gilbert <[email protected]>
update 'counsel-bookmark' with the ability to create, edit, and delete
bookmarks
---
counsel.el | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/counsel.el b/counsel.el
index 387877c..162a22e 100644
--- a/counsel.el
+++ b/counsel.el
@@ -618,17 +618,23 @@ input corresponding to the chosen variable."
;;;###autoload
(defun counsel-bookmark ()
- "Forward to `bookmark-jump'."
+ "Forward to `bookmark-jump' or `bookmark-set' if bookmark doesn't exist."
(interactive)
(require 'bookmark)
- (ivy-read "Jump to bookmark: "
+ (ivy-read "Create or jump to bookmark: "
(bookmark-all-names)
:action (lambda (x)
- (with-ivy-window
- (bookmark-jump x)))
- :require-match t
+ (if (member x (bookmark-all-names))
+ (with-ivy-window
+ (bookmark-jump x))
+ (bookmark-set x)))
:caller 'counsel-bookmark))
+(ivy-set-actions
+ 'counsel-bookmark
+ '(("d" bookmark-delete "delete")
+ ("e" bookmark-rename "edit")))
+
(defun counsel-M-x-transformer (cmd)
"Return CMD appended with the corresponding binding in the current window."
(let ((binding (substitute-command-keys (format "\\[%s]" cmd))))