File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -8,18 +8,22 @@ local CaptureWindow = require('orgmode.capture.window')
8
8
local Date = require (' orgmode.objects.date' )
9
9
local Datetree = require (' orgmode.capture.template.datetree' )
10
10
11
+ --- @alias OrgOnCaptureClose fun ( capture : OrgCapture , opts : OrgProcessCaptureOpts )
12
+
11
13
--- @class OrgCapture
12
14
--- @field templates OrgCaptureTemplates
13
15
--- @field closing_note OrgCaptureWindow
14
16
--- @field files OrgFiles
17
+ --- @field on_close OrgOnCaptureClose
15
18
--- @field _window OrgCaptureWindow
16
19
local Capture = {}
17
20
Capture .__index = Capture
18
21
19
- --- @param opts { files : OrgFiles , templates ?: OrgCaptureTemplates }
22
+ --- @param opts { files : OrgFiles , templates ?: OrgCaptureTemplates , on_close ?: OrgOnCaptureClose }
20
23
function Capture :new (opts )
21
24
local this = setmetatable ({}, self )
22
25
this .files = opts .files
26
+ this .on_close = opts .on_close
23
27
this .templates = opts .templates or Templates :new ()
24
28
this .closing_note = this :_setup_closing_note ()
25
29
return this
@@ -69,6 +73,9 @@ function Capture:on_refile_close()
69
73
if not opts then
70
74
return
71
75
end
76
+ if self .on_close then
77
+ self .on_close (self , opts )
78
+ end
72
79
if is_modified then
73
80
local choice =
74
81
vim .fn .confirm (string.format (' Do you want to refile this to %s?' , opts .destination_file .filename ), ' &Yes\n &No' )
You can’t perform that action at this time.
0 commit comments