Olical / conjure

Interactive evaluation for Neovim (Clojure, Fennel, Janet, Racket, Hy, MIT Scheme, Guile, Python and more!)
https://conjure.oli.me.uk
The Unlicense
1.72k stars 109 forks source link

Closing the log window with :q! remove syntax highlighting #586

Closed Olical closed 1 month ago

Olical commented 1 month ago

As reported by Max Savchenko on Discord:

I'm observing strange behaviour: if I close conjure buffer with :q! and then open a new one—it lacks syntax colors although it has ft=clojure in it. it gets fixed with :set ft=clojure

if i close buffer with g:conjure#mapping#log_close_visible everything is fine of course

I suspect the ! suffix is killing the buffer in some way, or maybe clearing it's buffer local settings without deleting the buffer. It's some sort of half dead state so Conjure isn't re-creating the buffer with all of the right options set in this case like it normally would.

Olical commented 1 month ago

Interestingly, bdelete doesn't cause this issue. quit is fine too, it's only quit! that seems to break the buffer. The :help on this call is:

:q[uit]!        Quit without writing, also when the current buffer has
            changes.  The buffer is unloaded, also when it has
            'hidden' set.
            If this is the last window and there is a modified
            hidden buffer, the current buffer is abandoned and the
            first changed hidden buffer becomes the current
            buffer.
            Use ":qall!" to exit always.

It mentions that it unloads a buffer even if it has hidden set. So maybe it's "unloading" and not deleting the buffer?

Olical commented 1 month ago

Yep! :bunload reproduces the issue too! So we just have to check if the buffer is loaded or not. If it's not then we need to re-initialise.

macovsky commented 1 month ago

thanks for taking care of this!