-
I'm on the currently latest version of auto-session (commit Expected Behaviorauto-session automatically restores a session, just like it has done for months without any problems. Actual BehaviorThe following error message is shown when a session is being restored. From what I can tell, the session is still correctly restored despite what the error message says. However, auto save is indeed disabled. I have not seen any such error message before, and
When I set No info in log files: Regardless of the setting of this config option, there's no additional information in neovim's log files about this error as far as I can tell. Has anyone come across this before? Environment
auto-session configuration: return {
{
"rmagatti/auto-session",
dependencies = {
"rcarriga/nvim-notify",
"nvim-telescope/telescope.nvim",
},
opts = {
log_level = "error",
auto_session_suppress_dirs = {
"~/Downloads",
"/",
"/tmp",
},
post_delete_cmds = {
[[lua vim.notify('Editor session deleted!', vim.log.levels.INFO, { title = 'Neovim' })]],
},
post_restore_cmds = {
[[lua vim.notify('Editor session restored!', vim.log.levels.INFO, { title = 'Neovim' })]],
},
post_save_cmds = {
[[lua vim.notify('Editor session saved!', vim.log.levels.INFO, { title = 'Neovim' })]],
},
-- session-lens related settings; nowadays merged into auto-session,
-- originally at https://github.com/rmagatti/session-lens (including docs)
session_lens = {
previewer = false,
prompt_title = "Editor Sessions",
},
},
},
}
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hmm, very interesting. Can you post the session file that generates the error when restoring? Should be in |
Beta Was this translation helpful? Give feedback.
Ok, I got to the bottom of it. The vim syntax file for sh scripts has these lines that are clearing some commands just in case they exist:
https://github.com/neovim/neovim/blob/6af9ca4926e05ac698d828ab6aeef2f45ccccdf8/runtime/syntax/sh.vim#L109-L113
That doesn't generate an error (because of the
sil!
) but it does setv:errmsg
. When we're restoring a session, we usesilent! source <session>
. the!
means it will keep restoring the session even if there's an error so we usev:errmsg
to catch any errors that might be generated while restoring the session. This case highlights the problem with that approach, namely that there might be other benign "errors" that setv:errmsg
but aren't really e…