Sunday, February 17, 2019

Re: mksession restore just deleted buffer

Le dimanche 17 février 2019 20:17:17 UTC+1, Salman Halim a écrit :
> On Sun, Feb 17, 2019, 12:45 <niva...@gmail.com wrote:
> Le dimanche 17 février 2019 18:32:04 UTC+1, Salman Halim a écrit :
>
> > On Sun, Feb 17, 2019, 11:54  <niva...@gmail.com wrote:
>
> > Le dimanche 17 février 2019 14:52:20 UTC+1, Salman Halim a écrit :
>
> >
>
> >
>
> > > After the "bd!", does listing buffers again confirm that it's gone?
>
> >
>
> > >
>
> >
>
> > no.
>
> >
>
> >
>
> >
>
> > Ah, so the session and autocommand aren't to blame. If you call "bd!" and the buffer is still there, then maybe bufwipe or something needs to be checked?
>
> >
>
> >
>
> >
>
> >
>
> > >
>
> >
>
> > > Have you examined the contents and timestamp of the session file to see if it contains the details of that buffer?
>
> >
>
> > >
>
> >
>
> > timestamp is good at vim leaving and it contains infos of that buffer :
>
> >
>
> >
>
> >
>
> > let SessionLoad = 1
>
> >
>
> > if &cp | set nocp | endif
>
> >
>
> > let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
>
> >
>
> > let v:this_session=expand("<sfile>:p")
>
> >
>
> > silent only
>
> >
>
> > if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
>
> >
>
> >   let s:wipebuf = bufnr('%')
>
> >
>
> > endif
>
> >
>
> > set shortmess=aoO
>
> >
>
> > argglobal
>
> >
>
> > %argdel
>
> >
>
> > $argadd ~/Desktop/thatbuffer.txt
>
> >
>
> > winpos 278 74
>
> >
>
> >
>
> >
>
> > It seems as if the session process isn't at fault here, but the buffer wiping is. 
>
> >
>
> >
>
> > The call to winpos seems to indicate that the buffer is still open in an active window? That's not consistent with a deleted buffer. 
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > >
>
> >
>
> > > How about disabling the autocommand and manually saving the session?
>
> >
>
> > >
>
> >
>
> > I don't want to lose interest of autocmd but I can try.
>
> >
>
> >
>
> >
>
> > I was trying to isolate the three different variables: buffer delete, autocommand and session making. 
>
> >
>
> >
>
> >
>
> >
>
> > >
>
> >
>
> > > Anything in your session options or viminfo that might be contributing something?
>
> >
>
> > >
>
> >
>
> > just classical set sessionoptions=help,winsize,winpos
>
> >
>
> >
>
> >
>
> > Yeah, that's innocuous. I was wondering whether viminfo might have something to do, but based on your session snippet above, it's clearly not viminfo. 
>
> >
>
> >
>
> > Salman
>
>
>
> Sorry, for the first point: when I use ":bd! NoOfBuffer", it is not listed yet. So bd is working well.
>
>
>
> Okay, so what happens if you close all tabs and leave in just one window, wiping/deleting all buffers, verify that :buffers looks good, showing only the open window, and then save the session? Does the session file still have buffers that it shouldn't?
>
>
> Basically, I'm trying to figure out whether there's a bug in buffer deletion, session creation or the autocommand mechanism, but to do that we need to create a simple example that demonstrates the problem and eliminates any potential human error. 
>
>
> Salman

Okay I've done some further tests.

:bufdo! bd! >> clear all buffers as you said.

Yesterday I had copied my session.vim file into ~/desktop so it seems it take care about history actions.

When I close Vim, no buffer is listed in buffers'list.
When I open Vim again, buffers'list contains my yesterday ~/desktop/sessions.vim which is not exsiting anymore.

... see the gif.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: