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.76k stars 109 forks source link

Conjure interfering with automatic sessions #244

Open mixedCase opened 3 years ago

mixedCase commented 3 years ago

I'm using https://github.com/rmagatti/auto-session to automatically manage sessions, and whenever I open a session where Conjure is loaded I end up losing a random buffer to an empty conjure-log-NNNNN.cljc (Ns being a random number) file and a red error message at the bottom with Error executing vim.schedule lua callback: .../nvim/site/pack/packer/start/conjure/lua/conjure/log.lua:86: attempt to concatenate a nil value.

As evidenced by the error message, I'm loading conjure with packer. It's pinned to tag v4.23.0.

Manually saving and loading sessions with :mksession and :source works, which leads me to believe there's a race condition somewhere where Conjure is, pardon the pun, conjuring a buffer somewhere for its logs in a way that interferes with sessions.

I'd be happy to debug the issue further pending instructions.

Olical commented 2 years ago

Did this happen to get fixed on develop recently? I wonder if it's to do with #284...

mixedCase commented 2 years ago

Afraid not. Just tried loading conjure from develop branch and latest auto-session. Same behavior as before. Log buffer comes up taking a random window for itself, error message comes up, and the status line gets moved about 75%, leaving a small space for editing until I manually drag it back down.

Olical commented 2 years ago

The only thing I can think of trying right now is removing buffer from the sessionoptions so that hidden buffers (such as the log) aren't saved, only those that you can see in windows.

Here's the sessionopts I've used in the past that I know work well:

(set nvim.o.sessionoptions "blank,curdir,folds,help,tabpages,winsize")

I'll have a look at mitigating this too but I don't understand the error yet so it might be a bit tricky.

johngrib commented 2 years ago

(I am Korean. So I am not good at English, so the sentences I wrote may not be read naturally. Thank you.)

I experienced the same(similar?) issue. (But I am not an user of auto-session. I used the :mksession this time.) After saving the session, open the session file, there is a line that badd +x conjure-log-xxxxx.cljc as shown in the attached image. If I delete this line and open a session in vim, no problem. But if I don't delete the badd line, I get the same problem.

image

image

I tried to trace the exception. When I comment out the client.get function call in log.lua file, no exception is thrown.

image

When I checked the def written in the files, it seems to be a problem that occurs because a session is opened first before the buf-suffix string value is assigned for each language, and the setting value becomes nil. So it seems that an error is thrown when concating the buffer name string with ..

image

So my temporary solution is to execute a shell script that modifies the session file when I start or exit Vim. That shell script deletes the remaining (random numbered) conjure log buffer lines from my session file.

image

image

I like conjure, and hopefully the session issue will be fixed soon. Thank you.

Olical commented 2 years ago

Thank you for the detailed report! I will try to find a fix for this soon, I hope there's a flag I can put on the buffer to ensure it's not saved in sessions but I can't find it yet.

If anyone finds a buffer local option that excludes buffers from saved sessions please do let me know.