tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.75k stars 139 forks source link

evaluation corrupts buffer? #145

Closed acthp closed 10 years ago

acthp commented 10 years ago

I have no idea what's happening, actually, but when doing cp% to evaluate a form, if an error is thrown during evaluation the entire contents of the buffer are replaced with a stack trace. The status line changes to this:

datasets.clj :setloclist()

where datasets.clj is the file name. I don't know why setloclist is there, or what it means.

If I open the buffer in another window with :e datasets.clj I get the stack trace. In the original window, doing u to undo the changes throws error Cannot make changes, 'modifiable' is off. If I explicitly set modifiable, u then errors out with line numbers wrong.

Is there some way to recover the buffer? The only thing I know to do is delete the buffer with :bdelete! and load the last saved version from disk.

tpope commented 10 years ago

Can you consistently reproduce this in a fresh Vim instance? Sounds like you might be accidentally editing your file from inside a location list window.

acthp commented 10 years ago

So far unable to repro consistently. It's happened a few times with :Eval as well. I'll try to narrow it.

acthp commented 10 years ago

Can reproduce it now. Steps:

:Eval (blah)
:Eval (blah)

Note that when doing the second Eval the cursor is in the original source buffer. You can move around in it, make edits, whatever. The location list window is open, but is not the current buffer. :ls shows the source buffer as the current buffer, with %.

The second step can also be cp%, and probably any other command that will evaluate an expression that may throw an error.

tpope commented 10 years ago

Where is the step where you open the location list window?

acthp commented 10 years ago

It opens automatically on step one (assuming blah isn't defined, and will throw an error).

Basically, it's invoked by doing an evaluation while the location list window is open, but is not the current buffer. In that scenario, the current buffer gets hammered.

tpope commented 10 years ago

If that's the case you're at least a year out of date. Update fireplace and report back if it's still an issue.

acthp commented 10 years ago

ack! Sorry, forgot I was on an old server. All better now. Thanks!