1

I am trying to use Bookmark+ because I would like the ability to create bookmarks with the same name that jump to locations in different files.

E.g. I have files foo and bar open in emacs. I would like to create bookmarks named a, b and c that map to three different locations in foo. I would also like to create three additional bookmarks also named a, b and c, and these should allow me to jump to different locations in bar.

Then, if the file foo is loaded in the current buffer I would like to jump to bookmark a in foo. If I then switch the current buffer to file bar and jump to bookmark a, I would like to be directed to the location of a within file bar.

I have read the Bookmark+ docs and believe this to be possible. I have tried creating bookmarks with C-x p m and C-u C-x p m, and jumping to them using C-x j f and C-x j , , but often I end up being directed to the wrong file.

Which commands should I be using to set and navigate to these types of file-specific bookmark?

--

Follow up

Thanks @Drew for this clear explanation, I think I understand now. I have recently tried to play with icicles but I think the install didn't go quite right and I got errors. Maybe I'll have another go.

Why do I want to do this? Mostly idle curiosity I have to admit. I really like the idea of not having to worry about duplicating bookmark names, and as I understand it this is supported and works if I use the bookmark-list display. The reason for trying to use the jump commands is to save keystrokes. I can navigate to a vanilla bookmark in three keystrokes: one bound to a command to list bookmarks, one character to filter to a specific bookmark, enter and I'm there. To do the same using bookmark+ I'm currently doing: one key bound to C-x p ,, / to start search, a filter character, Enter, then multiple Down key to get to the bookmark I want, then enter. Four plus at least three or four cursor downs (I'm working from memory here).

1 Answer 1

0

Updated after bug fix

Your observations were correct - you weren't imagining things. If you used the bookmark-list display there was no problem. But for most jump commands there was a bug.

I think I've fixed the bug now. (Lightly tested.) Please download and try the latest. Thanks for inciting me to fix this.


This was the problem, FYI:

C-x j , , (bmkp-this-buffer-jump) reads a bookmark name, completing against names of bookmarks for the current buffer (only). But the string returned from completing-read is unpropertized -- it's just "a" (in your example), with no information about the bookmark itself (position, file, etc.).

That string name was being passed to the general jump function, which looks up the name in the current full current bookmark list, not in just the bookmarks for that buffer. So it can get the wrong bookmark named "a".

Likewise for other type-specific jump commands - they were reading the bookmark name correctly, using only a specific list of bookmarks as completion domain, but the bookmark name read was getting looked up in the general bookmark alist, not the list of bookmarks relative to the command.


On the other hand, if you used Icicles then in Icicle mode the same Bookmark+ jump keys have enhanced behavior, and there what you want was already what happens.

When you use an Icicles bookmark jump command, you see, as the completion candidates, both the bookmark name and the file name, and you can complete against either or both. So there's no such confusion/bug, for you or for the completion function.

The fact that I myself use both Bookmark+ and Icicles is maybe one reason I hadn't bothered to fix this for just Bookmark+.

9
  • Are you able to provide an explicit example, with keystrokes, of how to set two marks identically named but for different files? I now have icicles and bookmarks+ installed but still can't seem to get it to work. Commented Jul 3, 2020 at 11:33
  • Possibly related: (icy-mode 1) giving error "Debugger entered--Lisp error: (error "Key sequence <escape> <tab> starts with non-prefix key <escape>")". Am using spacemacs config btw. Commented Jul 3, 2020 at 12:06
  • You yourself gave an example: creating bookmarks with C-x p m and C-u C-x p m. Do that in different files, providing the same bookmark name. See what C-h RET tells you for them in the bookmark-list display, or just show the file-name column there. (This is independent of Icicles.)
    – Drew
    Commented Jul 3, 2020 at 16:14
  • I know nothing about Spacemacs. Try, at least as a sanity check and my info, starting from emacs -Q (no init file), loading Bookmark+ and Icicles, and turning on icy-mode. If you don't see that error then bisect your init file to find the culprit.
    – Drew
    Commented Jul 3, 2020 at 16:18
  • Just what key sequence did you use, to get that error? (It seems to be M-TAB. In what context were you using that?) For vanilla Emacs, ESC is definitely a prefix key, and it should remain so. Is that not the case for Spacemacs?
    – Drew
    Commented Jul 3, 2020 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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