@@ -14,16 +14,18 @@ local Datetree = require('orgmode.capture.template.datetree')
14
14
--- @field templates OrgCaptureTemplates
15
15
--- @field closing_note OrgCaptureWindow
16
16
--- @field files OrgFiles
17
- --- @field on_close OrgOnCaptureClose
17
+ --- @field on_pre_refile OrgOnCaptureClose
18
+ --- @field on_post_refile OrgOnCaptureClose
18
19
--- @field _window OrgCaptureWindow
19
20
local Capture = {}
20
21
Capture .__index = Capture
21
22
22
- --- @param opts { files : OrgFiles , templates ?: OrgCaptureTemplates , on_close ?: OrgOnCaptureClose }
23
+ --- @param opts { files : OrgFiles , templates ?: OrgCaptureTemplates , on_pre_refile ?: OrgOnCaptureClose , on_post_refile ?: OrgOnCaptureClose }
23
24
function Capture :new (opts )
24
25
local this = setmetatable ({}, self )
25
26
this .files = opts .files
26
- this .on_close = opts .on_close
27
+ this .on_pre_refile = opts .on_pre_refile
28
+ this .on_post_refile = opts .on_post_refile
27
29
this .templates = opts .templates or Templates :new ()
28
30
this .closing_note = this :_setup_closing_note ()
29
31
return this
150
152
--- @private
151
153
--- @param opts OrgProcessCaptureOpts
152
154
function Capture :_refile_from_capture_buffer (opts )
155
+ if self .on_pre_refile then
156
+ self .on_pre_refile (self , opts )
157
+ end
153
158
local target_level = 0
154
159
local target_line = - 1
155
160
local destination_file = opts .destination_file
@@ -192,8 +197,8 @@ function Capture:_refile_from_capture_buffer(opts)
192
197
end )
193
198
:wait ()
194
199
195
- if self .on_close then
196
- self .on_close (self , opts )
200
+ if self .on_post_refile then
201
+ self .on_post_refile (self , opts )
197
202
end
198
203
utils .echo_info ((' Wrote %s' ):format (destination_file .filename ))
199
204
self :kill ()
0 commit comments