Closed lyz-code closed 6 months ago
@kristijanhusak can you please take a look and suggest what I'm doing wrong? With these changes the plugin doesn't work with nightly
@lyz-code you are using some internals that were changed. I'll expose some API calls for you so you can leverage that instead. I'll let you know.
@lyz-code I just pushed https://github.com/nvim-orgmode/orgmode/commit/b47e76f404dd908ad6c652abb6b915b2be564418 to nightly branch, that adds two new API methods:
get_closest_headline
on file class
refile
on the main API class
This should cover all needs for your plugin here. This is a usage example:
local api = require('orgmode.api')
local closest_headline = api.current():get_closest_headline()
-- Refile to the end of the destination file
local destination = api.load('/path/to/destination/file.org')
-- Or refile to specific headline in the destination
local destination = api.load('/path/to/destination/file.org').headline[3]
-- If doing refile from capture window, it will be automatically closed after the refile
-- So there is no need to worry about that
return api.refile({
source = closest_headline,
destination = destination
})
Thank you so much as always for your quick answer and fix. I'll try to implement it today <3
The code is much cleaner now @kristijanhusak thank you so much. I'll wait for the nightly
branch to be merged in order to merge this one
@lyz-code Note that nightly was merged into master so you can merge this in.
Thanks for thinking of me and notifying of the merge <3
Closes #5