Skip to content

Commit eee5cbe

Browse files
committed
Move nfnl.callback to the define system
1 parent 5c01eea commit eee5cbe

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

fnl/nfnl/callback.fnl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(local {: autoload} (require :nfnl.module))
1+
(local {: autoload : define} (require :nfnl.module))
22
(local core (autoload :nfnl.core))
33
(local str (autoload :nfnl.string))
44
(local fs (autoload :nfnl.fs))
@@ -7,6 +7,9 @@
77
(local config (autoload :nfnl.config))
88
(local api (autoload :nfnl.api))
99
(local notify (autoload :nfnl.notify))
10+
(local vim _G.vim)
11+
12+
(local M (define :nfnl.callback))
1013

1114
(fn fennel-buf-write-post-callback-fn [root-dir cfg]
1215
"Builds a function to be called on buf write. Adheres to the config passed
@@ -30,14 +33,14 @@
3033

3134
nil))
3235

33-
(fn supported-path? [file-path]
36+
(fn M.supported-path? [file-path]
3437
"Returns true if we can work with the given path. Right now we support a path if it's a string and it doesn't start with a protocol segment like fugitive://..."
3538
(or
3639
(when (core.string? file-path)
3740
(not (file-path:find "^[%w-]+:/")))
3841
false))
3942

40-
(fn fennel-filetype-callback [ev]
43+
(fn M.fennel-filetype-callback [ev]
4144
"Called whenever we enter a Fennel file. It walks up the tree to find a
4245
.nfnl.fnl (which can contain configuration). If found, we initialise the
4346
compiler autocmd for the directory containing the .nfnl.fnl file.
@@ -46,7 +49,7 @@
4649
different .nfnl.fnl configuration, wonderful!"
4750

4851
(let [file-path (fs.full-path (. ev :file))]
49-
(when (supported-path? file-path)
52+
(when (M.supported-path? file-path)
5053
(let [file-dir (fs.basename file-path)
5154
{: config : root-dir : cfg} (config.find-and-load file-dir)]
5255

@@ -101,5 +104,4 @@
101104
:complete "file"
102105
:nargs "?"}))))))
103106

104-
{: fennel-filetype-callback
105-
: supported-path?}
107+
M

lua/nfnl/callback.lua

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)