Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to base buffer when updating imenu #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dvzubarev
Copy link

When current buffer is indirect and the base buffer is visible, reuse imenu--index-alist from the base buffer.
Should fix #30

@joaotavora
Copy link
Owner

Let's continue here.

Yes. If a base buffer is visible then it will compute imenu-buffer-alist, that can be reused in an indirect buffer. On the other hand, if the base buffer is hidden, then the indirect buffer should request an update of imenu-buffer-alist by itself. Otherwise it won't be updated. But it occurred to me now that it won't help, if there are two indirect buffers and the base buffer is hidden.
Both indirect buffers will request an update and one of them will hang.

Right. I think for this to work we need to always do the work in the base buffer, regardless of whether it's visible or not. So if an indirect buffer was going to request it, it shouldn't. It should pretend the base buffer wants to (even if it doesn't), by using with-current-buffer base. Then when the result comes in, assign the to the indirect buffer. Something like that. Cna't think very well right now. Good luck!

It is done to assure that imenu is updated only once for all indirect buffers.

* breadcrumb.el (bc--ipath-alist): switch to base buffer.
@dvzubarev dvzubarev changed the title Do not recreate imenu when base buffer is visible Switch to base buffer when updating imenu Mar 8, 2024
@joaotavora
Copy link
Owner

Does this most recent version work already for you and fix #30? Because it looks very simple conceptually, which is good.

@dvzubarev
Copy link
Author

Yes, it works for me. I've been using breadcrumb with this fix for a while. I haven't noticed any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with indirect buffers
2 participants