-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
[WIP][RFC] Open tmp window: handle case where tmp window is prev window #488
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @Maltimore 👍
lua/orgmode/utils/init.lua
Outdated
end | ||
else | ||
local prev_bufnr = vim.api.nvim_buf_get_var(0, 'org_prev_buffer') | ||
vim.api.nvim_set_current_buf(prev_bufnr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to also run the checks on bufnr
.
if prev_bufnr and vim.api.nvim_buf_is_valid(prev_bufnr) ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, what should happen if the bufnr
is invalid? With winnr
the window gets closed in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point(s). I suppose if the prev_bufnr
is invalid, we should simply unload the capture buffer and vim will automatically switch to some other buffer?
You can run the tests with
if it's the first time you run them, be sure to get the dependencies before that
All those are ran from the root of the repository |
b05d0a3
to
87476e3
Compare
87476e3
to
421f6a2
Compare
I pushed a change incorporating your suggestion, thanks again. |
Hey @Maltimore, sorry it took me so long to respond. When the |
9094379
to
abff0dc
Compare
44754e8
to
5143eed
Compare
This is my first ever contribution to an nvim plugin, so take everything with a grain of salt.
This PR fixes an issue when the
win_split_mode
is set such that no new window is opened, but instead the agenda/capture buffer are opened in the current window. See the following excerpt of my org config:There is a problem when "finalizing" the capture (with
<C-c>
by default), namely that it tries to close the temporary window. But a temporary window had never been opened.I wonder if this PR is at all going in the right direction. I haven't run the test suite yet as I haven't yet learned how that works. I'll hopefully get to it in the next days unless you tell me now that this PR doesn't make sense.