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')
88local Date = require (' orgmode.objects.date' )
99local Datetree = require (' orgmode.capture.template.datetree' )
1010
11+ --- @alias OrgOnCaptureClose fun ( capture : OrgCapture , opts : OrgProcessCaptureOpts )
12+
1113--- @class OrgCapture
1214--- @field templates OrgCaptureTemplates
1315--- @field closing_note OrgCaptureWindow
1416--- @field files OrgFiles
17+ --- @field on_close OrgOnCaptureClose
1518--- @field _window OrgCaptureWindow
1619local Capture = {}
1720Capture .__index = Capture
1821
19- --- @param opts { files : OrgFiles , templates ?: OrgCaptureTemplates }
22+ --- @param opts { files : OrgFiles , templates ?: OrgCaptureTemplates , on_close ?: OrgOnCaptureClose }
2023function Capture :new (opts )
2124 local this = setmetatable ({}, self )
2225 this .files = opts .files
26+ this .on_close = opts .on_close
2327 this .templates = opts .templates or Templates :new ()
2428 this .closing_note = this :_setup_closing_note ()
2529 return this
@@ -69,6 +73,9 @@ function Capture:on_refile_close()
6973 if not opts then
7074 return
7175 end
76+ if self .on_close then
77+ self .on_close (self , opts )
78+ end
7279 if is_modified then
7380 local choice =
7481 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