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

cache bufnr to prevent error while processing autoclose autocmd #576

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ribru17
Copy link

@ribru17 ribru17 commented May 7, 2023

Problem:
I would frequently get errors while closing previewing markdown buffers saying:

Error detected while processing BufHidden Autocommands for "<buffer=1>"..function mkdp#rpc#preview_close[11]..mkdp#autocmd#clear_buf:
line    1:
E216: No such group or event: MKDP_REFRESH_INIT10

This was because the auto-close autocmd would run after the buffer was already closed, and the plugin thought it needed to close my next opened buffer (some other non-markdown file) which of course was incorrect behavior.

Solution:
I fixed this by caching the buffer number of the actual markdown buffer I needed and then passing it down to each function that needed the buffer number to close it. I would really love to see this merged as this issue was quite annoying to me. Thanks for the great plugin

@ribru17
Copy link
Author

ribru17 commented May 7, 2023

By the way I have tested this a good deal and I believe it closes #316.

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.

1 participant