I have most of my bookmarks with a letter prefix such that the first letter almost always uniquely identifies the bookmark. Thus, I can, for example, go to the source folder (with the "s: source" tab) using Mx bookmark-jump RET s RET . I have a shortcut, so actually ~ s RET .
I would like to get rid of RET at the end, i.e. get Mx bookmark-quick-jump RET s or ~ s to do the above work. I would also like to return to the default behavior: show me all bookmarks that start with a given letter, if not one option.
So far I have had:
(defun bookmark-do-quick-jump (str) (let ((completions (all-completions str bookmark-alist))) (bookmark-jump (if (eq 1 (length completions)) (car completions) (completing-read "Jump to bookmark: " bookmark-alist nil t str)))))
There are two more hiccups:
Firstly, I need to somehow jump into the minibuffer and insert this card there (I don’t know how to do this):
(setq bookmark-quick-jump-map (let ((map (make-sparse-keymap))) (mapcar (lambda (key) (define-key map key (lambda() (interactive) (bookmark-do-quick-jump key)))) (loop for c from ?a to ?z collect (string c))) map))
Secondly, when I call
(bookmark-do-quick-jump "o")
It comes back with three options (org-capture-last-stored, org-capture-last-stored-marker ...). I'm in the minibuffer now, but I still need to press RET RET to see these 3 options. I would like it to be done automatically.
I would appreciate any answers that either directly answer my two problems, or a completely different approach if I can get the behavior and usability that I described.
UPD:
I solved the second thing by switching from completing-read to ido-completing-read :
(defun bookmark-do-quick-jump (str) (let ((completions (all-completions str bookmark-alist))) (bookmark-jump (if (eq 1 (length completions)) (car completions) (ido-completing-read "Jump to bookmark: " completions nil t str)))))
By the way, I forgot to mention that I use bookmark+ . I'm not sure if jump is supported by default bookmark-jump .