Skip to content

Commit 1cedbca

Browse files
committed
Always read buffer contents on EvalBuffer
It is more useful to be able to make changes to a namespace for evaluation, e.g. during debugging, that do not end up being saved.
1 parent 4dae3cd commit 1cedbca

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/socket_repl/socket_repl_plugin.clj

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,10 @@
145145
(run-command
146146
plugin
147147
(fn [msg]
148-
(let [buffer (api/get-current-buf nvim)
149-
filename (api.buffer/get-name nvim buffer)]
150-
(if (.exists (io/as-file filename))
151-
(do
152-
;; Not sure if saving the file is really always what we want,
153-
;; but if we don't, stale data will be loaded.
154-
(api/command nvim ":w")
155-
(async/>!! code-channel (format "(load-file \"%s\")" filename)))
156-
(let [code (string/join "\n" (api.buffer-ext/get-lines
157-
nvim buffer 0 -1))]
158-
(async/>!! code-channel (format "(eval '(do %s))" code))))))))
148+
(let [buffer (api/get-current-buf nvim)]
149+
(let [code (string/join "\n" (api.buffer-ext/get-lines
150+
nvim buffer 0 -1))]
151+
(async/>!! code-channel (format "(eval '(do %s))" code)))))))
159152

160153
(nvim/register-method!
161154
nvim

0 commit comments

Comments
 (0)