1

Using Spacemacs, if I SPC f r to search for recent files I am prompted for a pattern. I can enter e.g. a value of our which will match a file named Journal.org.

However if I do C-x r b to jump to a bookmark, and then enter some text to match, the match appears to only work at the beginning of the bookmark name. In other words, entering git will not match in the bookmark jump list a bookmark of KB/Git. However, if I have jumped to KB/Git previously, searching for git will offer KB/Git in the jump history.

Is there a way of suggesting bookmark names where the entered pattern matches any part of the bookmark name, like it does when searching for recent files?

I am aware I can co C-x r l and then search with / but am wondering if I can get the same result using C-x r b.

0

ivy/counsel can do this. Just install counsel and put (counsel-mode t) somewhere into your configuration. C-x r b should get remapped to counsel-bookmark which uses ivy for completing bookmark names.

0

C-x r b is bound by default to bookmark-jump, which uses standard function completing-read to read a bookmark name.

So this is not something special about bookmark names or their completion. It's a question about completing-read in general.

You can customize option completion-styles to control what kind of matching completing-read uses. You can use various "fancy" matching styles, such as "flex"/"scatter" and "partial-completion".

Some completion "engines" or alternatives provide even more matching possibilities, but they don't necessarily do that for completing-read - they may do it for their own function instead.

If you use Icicles then that's not a problem. You have additional possibilities for how completing-read does its matching. And you can also use icicle-bookmark for C-x r b -- it improves upon the vanilla bookmark-jump.

  • This probably explains why on two different installs I see different behaviour. One matches what I describe in the initial question, the other performs a match anywhere in the pattern. completion-styles is set to the same on both installs. Is there another setting I should be looking at? completion-category-overrides is also same. – user2567544 Nov 21 '19 at 14:22
  • No idea. The devil is probably in the details. What do you mean by "different installs"? Of Emacs? Different versions? Different platforms/OSes? Be sure to compare using emacs -Q in both "installs" (no init file). – Drew Nov 21 '19 at 15:12
0

I used helm-bookmarks instead of bookmark-jump and this allowed searching via a partial bookmark match.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.