Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions fnl/emission/init.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,10 @@
new-end-col-offset
new-end-byte-offset]
(if (. cache.buf->detach? buf)
true
(do
(tset cache.buf->detach? buf nil)
(debug! "detached from buf" buf)
true)
;; NOTE: Return a truthy value to detach.
;; NOTE: `on_bytes` would be called before buf becomes valid; therefore,
;; check to detach should only be managed by `buf->detach` value.
Expand Down Expand Up @@ -347,10 +350,6 @@
;; HACK: Keep the `nil` to make sure not to detach unexpectedly.
nil)))

(fn on-detach [_string-detach buf]
(tset cache.buf->detach? buf nil)
(debug! "detached from buf" buf))

(fn excluded-buf? [buf]
(or (vim.list_contains cache.config.attach.excluded_buftypes
(. vim.bo buf :buftype))
Expand All @@ -375,7 +374,8 @@
(do
(cache-old-texts buf)
(vim.api.nvim_buf_attach buf false
{:on_bytes on-bytes :on_detach on-detach})
;; NOTE: on_detach does not work?
{:on_bytes on-bytes})
(debug! "attached to buf" buf))
(debug! "the buf did not meet the requirements to be attached" buf))
(vim.defer_fn cache.config.attach.delay))
Expand Down
8 changes: 3 additions & 5 deletions lua/emission/init.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.