alphapapa / org-bookmark-heading

Emacs bookmark support for Org-mode
GNU General Public License v3.0
93 stars 8 forks source link

add support to ivy/counsel #2

Closed zeltak closed 8 years ago

zeltak commented 8 years ago

Hi again

i noticed that in other completion packages for bookmarks such as ivy/swiper:

https://github.com/abo-abo/swiper

you cant see the org-bookmarks. ive raised this issue with the dev (see https://github.com/abo-abo/swiper/issues/567) and he said:

If you look at the code of org-bookmark-heading, you'll see that it works with Helm because it has specific code support for Helm. I suggest that you ask the package maintainer to add either Ivy support or generic completion support.

any chance to add support to ivy?

thx!

Z

alphapapa commented 8 years ago

Hey Z,

Hmmm. Well, I don't use Ivy myself, so I'm not sure here. It seems like a nice and well-made package, but Helm works well enough for me, and has additional features that I like, so I haven't felt a reason to switch or to install Ivy.

Actually, the code in this package that is specific to Helm only adds the indirect-jump action to the list of actions in Helm. Other than that, it doesn't do anything special for Helm. The helm-bookmark package supports Emacs bookmarks, and so it handles the primary functionality in this package automatically.

I looked at the issue you linked, and you said that some of the bookmarks don't appear in ivy-switch-buffer. I don't know what that command does exactly; I assume it gives a list of buffers, but maybe it also lists bookmarks? If so, it should work with any Emacs bookmark. If it doesn't show bookmarks made with this package, it is probably a bug in Ivy. You mentioned in that issue that some other bookmarks aren't listed as well, so that seems likely.

All this package does is provide the necessary handler functions for native Emacs bookmark support, so any package that properly integrates with Emacs' bookmark system (like Bookmarks+) should work with bookmarks created with this package. The Helm-specific code is just for extra convenience for the indirect-jumping.

So I'm guessing that it's an issue with Ivy. Maybe it doesn't handle correctly bookmarks that use non-standard handler functions? It shouldn't matter, but maybe something was hard-coded where it shouldn't have been.

So I guess I would tell abo-abo to take another look at the code in this package, and he'll see that the Helm-specific code doesn't matter, so it must be something to do with Ivy. :)

Or maybe you have another package interacting and causing the problem. Try to reproduce it in the MELPA sandbox with only Ivy and this package installed. If it still doesn't seem to work right, it must be something to do with Ivy.

I'll leave this issue open for now. Please let me know what you find out. :)

alphapapa commented 8 years ago

Followup: I glanced at the code in Ivy, and it looks like it probably doesn't work because it handles bookmarks as "virtual buffers," and rather than calling bookmarks' defined handler functions, it just tries to jump to the associated buffer or file. It looks to me like Ivy needs to have its bookmark support rewritten to use the bookmark handlers in bookmark-alist, otherwise it will only work with basic Emacs bookmarks that simply point to a file.

I went ahead and posted a comment on that issue. It should be a fairly easy change to make to Ivy.