mksession restore just deleted buffer

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

mksession restore just deleted buffer

Ni Va
Hi,


In _vimrc sessionoptions are defined as is :

set sessionoptions=help,winsize,winpos,buffers

I have two buffers in buffers' list and after buffer deleting the second one, restarting vim, it is always in the buffers's list.


I don't understand why it appears again.

Thank you
NiVa

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

vim.gif (31K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

trialero
On Thu, Feb 14, 2019 at 01:31:26PM -0800, [hidden email] wrote:
> I have two buffers in buffers' list and after buffer deleting the second one, restarting vim, it is always in the buffers's list.
>
> I don't understand why it appears again.

You have to update the vim session you made by using `:mks!`

//meine

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Le vendredi 15 février 2019 11:57:05 UTC+1, meine a écrit :
> On Thu, Feb 14, 2019 at 01:31:26PM -0800, [hidden email] wrote:
> > I have two buffers in buffers' list and after buffer deleting the second one, restarting vim, it is always in the buffers's list.
> >
> > I don't understand why it appears again.
>
> You have to update the vim session you made by using `:mks!`
>
> //meine

It's done via these :


if has('autocmd')
        aug Geometry
                au!
                au VimLeavePre * call geometry#SaveGeometry()
                au VimEnter    * call geometry#RestoreGeometry()
        aug END
endif


fun! geometry#MkSession() "{{{
  silent! execute 'mks! '.g:geometry#sessionfile
endfunction "}}}

fun! geometry#GetGeometry() "{{{
  return [&columns,&lines] + getwinpos()
endfunction "}}}

fun! geometry#SaveGeometry() "{{{
  let ret = writefile(geometry#GetGeometry(), g:geometry#file, 'b')
  call geometry#MkSession()
endfunction "}}}

fun! geometry#RestoreGeometry() "{{{

  if filereadable(g:geometry#file)
        let geom = readfile(g:geometry#file)    "137*21+156+156
        " if geom != ''
        "   let winsize = split(geom,'+')
        "   silent! execute 'set columns='.split(winsize[0],'*')[0]
        "   silent! execute 'set lines='.split(winsize[0],'*')[1]
        "   silent! execute "winpos ".winsize[1].' '.winsize[2]
        " endif
          silent! execute 'set columns='.geom[0]
          silent! execute 'set lines='.geom[1]
          silent! execute "winpos ".geom[2].' '.geom[3]
  endif

  if filereadable(g:geometry#sessionfile)
  silent! execute 'source '.g:geometry#sessionfile
  endif
endfunction "}}}

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

trialero
On Fri, Feb 15, 2019 at 08:57:52AM -0800, [hidden email] wrote:

> Le vendredi 15 février 2019 11:57:05 UTC+1, meine a écrit :
> > On Thu, Feb 14, 2019 at 01:31:26PM -0800, [hidden email] wrote:
> > > I have two buffers in buffers' list and after buffer deleting the second one, restarting vim, it is always in the buffers's list.
> > >
> > > I don't understand why it appears again.
> >
> > You have to update the vim session you made by using `:mks!`
> >
> > //meine
>
> It's done via these :
>
>
> if has('autocmd')

<snip>

I'm not a coder, so I don't see the details of how you do this,

but isn't it a rather complicated way instead of a built-in vim
function?

//meine

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Le samedi 16 février 2019 11:43:46 UTC+1, meine a écrit :

> On Fri, Feb 15, 2019 at 08:57:52AM -0800, [hidden email] wrote:
> > Le vendredi 15 février 2019 11:57:05 UTC+1, meine a écrit :
> > > On Thu, Feb 14, 2019 at 01:31:26PM -0800, [hidden email] wrote:
> > > > I have two buffers in buffers' list and after buffer deleting the second one, restarting vim, it is always in the buffers's list.
> > > >
> > > > I don't understand why it appears again.
> > >
> > > You have to update the vim session you made by using `:mks!`
> > >
> > > //meine
> >
> > It's done via these :
> >
> >
> > if has('autocmd')
>
> <snip>
>
> I'm not a coder, so I don't see the details of how you do this,
>
> but isn't it a rather complicated way instead of a built-in vim
> function?
>
> //meine
Nothing complicated,

your advise is coded in the function! geometry#MkSession()
  silent! execute 'mks! '.g:geometry#sessionfile

And this function is called just before leaving Vim (au VimLeavePre * call geometry#SaveGeometry())

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

trialero
> Nothing complicated,
>
> your advise is coded in the function! geometry#MkSession()
>   silent! execute 'mks! '.g:geometry#sessionfile
>
> And this function is called just before leaving Vim (au VimLeavePre * call geometry#SaveGeometry())

Merci!

//meine

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Le samedi 16 février 2019 11:56:37 UTC+1, meine a écrit :

> > Nothing complicated,
> >
> > your advise is coded in the function! geometry#MkSession()
> >   silent! execute 'mks! '.g:geometry#sessionfile
> >
> > And this function is called just before leaving Vim (au VimLeavePre * call geometry#SaveGeometry())
>
> Merci!
>
> //meine

Yes but this code does not work well...

when I list buffers ":buffers", it shows me old buffer that I delete ":bd! NoBu".

Then Leave Vim (so the autocmd does its job), relaunch Vim, the buffers' list contains again previous deleted buffer and a file is create at the original buffer's folder.

So not working.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Salman Halim


On Sun, Feb 17, 2019, 07:36 <[hidden email] wrote:
Le samedi 16 février 2019 11:56:37 UTC+1, meine a écrit :
> > Nothing complicated,
> >
> > your advise is coded in the function! geometry#MkSession()
> >   silent! execute 'mks! '.g:geometry#sessionfile
> >
> > And this function is called just before leaving Vim (au VimLeavePre * call geometry#SaveGeometry())
>
> Merci!
>
> //meine


Yes but this code does not work well...

when I list buffers ":buffers", it shows me old buffer that I delete ":bd! NoBu".

Then Leave Vim (so the autocmd does its job), relaunch Vim, the buffers' list contains again previous deleted buffer and a file is create at the original buffer's folder.

So not working.

After the "bd!", does listing buffers again confirm that it's gone?

Have you examined the contents and timestamp of the session file to see if it contains the details of that buffer?

How about disabling the autocommand and manually saving the session?

Anything in your session options or viminfo that might be contributing something?

Salman

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Le dimanche 17 février 2019 14:52:20 UTC+1, Salman Halim a écrit :

> On Sun, Feb 17, 2019, 07:36  <[hidden email] wrote:
> Le samedi 16 février 2019 11:56:37 UTC+1, meine a écrit :
>
> > > Nothing complicated,
>
> > >
>
> > > your advise is coded in the function! geometry#MkSession()
>
> > >   silent! execute 'mks! '.g:geometry#sessionfile
>
> > >
>
> > > And this function is called just before leaving Vim (au VimLeavePre * call geometry#SaveGeometry())
>
> >
>
> > Merci!
>
> >
>
> > //meine
>
>
>
>
>
> Yes but this code does not work well...
>
>
>
> when I list buffers ":buffers", it shows me old buffer that I delete ":bd! NoBu".
>
>
>
> Then Leave Vim (so the autocmd does its job), relaunch Vim, the buffers' list contains again previous deleted buffer and a file is create at the original buffer's folder.
>
>
>
> So not working.
>
>
>
> After the "bd!", does listing buffers again confirm that it's gone?
>
no.
>
> 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

>
> How about disabling the autocommand and manually saving the session?
>
I don't want to lose interest of autocmd but I can try.
>
> Anything in your session options or viminfo that might be contributing something?
>
just classical set sessionoptions=help,winsize,winpos

>
> Salman

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Salman Halim



On Sun, Feb 17, 2019, 11:54 <[hidden email] 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

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Sorry, for the first point: when I use ":bd! NoOfBuffer", it is not listed yet. So bd is working well.

Le dim. 17 févr. 2019 à 18:32, Salman Halim <[hidden email]> a écrit :



On Sun, Feb 17, 2019, 11:54 <[hidden email] 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

--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/DuaO_Sj9hg4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
In reply to this post by Salman Halim
Le dimanche 17 février 2019 18:32:04 UTC+1, Salman Halim a écrit :

> On Sun, Feb 17, 2019, 11:54  <[hidden email] 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.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Salman Halim

On Sun, Feb 17, 2019, 12:45 <[hidden email] wrote:
Le dimanche 17 février 2019 18:32:04 UTC+1, Salman Halim a écrit :
> On Sun, Feb 17, 2019, 11:54  <[hidden email] 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

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Le dimanche 17 février 2019 20:17:17 UTC+1, Salman Halim a écrit :

> On Sun, Feb 17, 2019, 12:45  <[hidden email] wrote:
> Le dimanche 17 février 2019 18:32:04 UTC+1, Salman Halim a écrit :
>
> > On Sun, Feb 17, 2019, 11:54  <[hidden email] 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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

vim.gif (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Le dimanche 17 février 2019 20:53:10 UTC+1, [hidden email] a écrit :

> Le dimanche 17 février 2019 20:17:17 UTC+1, Salman Halim a écrit :
> > On Sun, Feb 17, 2019, 12:45  <[hidden email] wrote:
> > Le dimanche 17 février 2019 18:32:04 UTC+1, Salman Halim a écrit :
> >
> > > On Sun, Feb 17, 2019, 11:54  <[hidden email] 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.
https://drive.google.com/open?id=1xPX4InUKhYEVrBuosfHqNk_SNRXY7PgT

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Salman Halim
> 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.

https://drive.google.com/open?id=1xPX4InUKhYEVrBuosfHqNk_SNRXY7PgT

1. Out of curiosity, what are the values of g:geometry#sessionfile and g:geometry#file?
2. Have you tried writing a separate session file out by hand right after doing the bufdo! bd! to see if it that session file contains anything different than the automatically generated one?
3. Have you tried using bufwipe instead of bufdelete? bufdo! bw! (That's "stronger" than deleting a buffer.)
4. The list of buffers is controlled through viminfo, not just sessions. What's the timestamp of your viminfo? Is it getting updated every time you quit? What are its contents? Could the buffer be coming back through that file?

Here's the thing: I don't have the autocommands that you do. I also cannot reproduce what you're seeing. I remove all my buffers, write out the session file with an empty Vim (by hand), quit and come back. The first thing I do is execute ':buffers' to confirm it's still empty and then load the session file. My second call to :buffers is STILL empty. I also have no buffers or args in my session file.

-- 
 
Salman

I, too, shall something make and glory in the making.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Le dimanche 17 février 2019 21:38:38 UTC+1, Salman Halim a écrit :

> > 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.
>
>
>
> https://drive.google.com/open?id=1xPX4InUKhYEVrBuosfHqNk_SNRXY7PgT
>
>
>
> 1. Out of curiosity, what are the values of g:geometry#sessionfile and g:geometry#file?
Ok rewrite the autoload vimscript as below : now jsut one session.

> 2. Have you tried writing a separate session file out by hand right after doing the bufdo! bd! to see if it that session file contains anything different than the automatically generated one?



> 3. Have you tried using bufwipe instead of bufdelete? bufdo! bw! (That's "stronger" than deleting a buffer.)

Tried :bufdo! bw! out of :bufdo! bd! then :buffers returns only noname buffer

Then I confirm the the attached mainsession.vim is written at vim leave.

And on reload, buffers command list noname and mainsession.Vim

> 4. The list of buffers is controlled through viminfo, not just sessions. What's the timestamp of your viminfo? Is it getting updated every time you quit? What are its contents? Could the buffer be coming back through that file?
>
:rviminfo says nothing.


>
> Here's the thing: I don't have the autocommands that you do. I also cannot reproduce what you're seeing. I remove all my buffers, write out the session file with an empty Vim (by hand), quit and come back. The first thing I do is execute ':buffers' to confirm it's still empty and then load the session file. My second call to :buffers is STILL empty. I also have no buffers or args in my session file.
>
> -- 
>
>  
> Salman
>
> I, too, shall something make and glory in the making.



autoload/geometry.vim
let g:geometry#sessionfile=expand('$vimruntime/sessions/mainSession.vim')

fun! geometry#SaveGeometry() "{{{

  echo 'Save'
  if !filereadable(g:geometry#sessionfile)
  call mkdir(expand('$vimruntime/sessions'),0700)
  endif
  silent! execute 'mks! '.g:geometry#sessionfile
endfunction "}}}

fun! geometry#RestoreGeometry() "{{{

  echo 'Restore'
  if filereadable(g:geometry#sessionfile)
  silent! execute 'source '.g:geometry#sessionfile
  endif
endfunction "}}}


--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

mainSession.vim (951 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Le lundi 18 février 2019 17:50:01 UTC+1, [hidden email] a écrit :

> Le dimanche 17 février 2019 21:38:38 UTC+1, Salman Halim a écrit :
> > > 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.
> >
> >
> >
> > https://drive.google.com/open?id=1xPX4InUKhYEVrBuosfHqNk_SNRXY7PgT
> >
> >
> >
> > 1. Out of curiosity, what are the values of g:geometry#sessionfile and g:geometry#file?
> Ok rewrite the autoload vimscript as below : now jsut one session.
>
> > 2. Have you tried writing a separate session file out by hand right after doing the bufdo! bd! to see if it that session file contains anything different than the automatically generated one?
>
>
>
> > 3. Have you tried using bufwipe instead of bufdelete? bufdo! bw! (That's "stronger" than deleting a buffer.)
>
> Tried :bufdo! bw! out of :bufdo! bd! then :buffers returns only noname buffer
>
> Then I confirm the the attached mainsession.vim is written at vim leave.
>
> And on reload, buffers command list noname and mainsession.Vim
>
> > 4. The list of buffers is controlled through viminfo, not just sessions. What's the timestamp of your viminfo? Is it getting updated every time you quit? What are its contents? Could the buffer be coming back through that file?
> >
> :rviminfo says nothing.
>
>
> >
> > Here's the thing: I don't have the autocommands that you do. I also cannot reproduce what you're seeing. I remove all my buffers, write out the session file with an empty Vim (by hand), quit and come back. The first thing I do is execute ':buffers' to confirm it's still empty and then load the session file. My second call to :buffers is STILL empty. I also have no buffers or args in my session file.
> >
> > -- 
> >
> >  
> > Salman
> >
> > I, too, shall something make and glory in the making.
>
>
>
> autoload/geometry.vim
> let g:geometry#sessionfile=expand('$vimruntime/sessions/mainSession.vim')
>
> fun! geometry#SaveGeometry() "{{{
>
>   echo 'Save'
>   if !filereadable(g:geometry#sessionfile)
>   call mkdir(expand('$vimruntime/sessions'),0700)
>   endif
>   silent! execute 'mks! '.g:geometry#sessionfile
> endfunction "}}}
>
> fun! geometry#RestoreGeometry() "{{{
>
>   echo 'Restore'
>   if filereadable(g:geometry#sessionfile)
>   silent! execute 'source '.g:geometry#sessionfile
>   endif
> endfunction "}}}
Solved, after some tests, it appears that sessionoptions in _vimrc need to be written like this :
set sessionoptions=buffers,help,resize,winpos,winsize,
instead of
set sessionoptions=buffers,help,resize,winpos,winsize

Otherwise, there is no restoration of winsize.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Salman Halim
A trailing comma shouldn't be required. Can a Vim dev have a look, please?

--

Salman

On Tue, Feb 19, 2019, 03:49 <[hidden email] wrote:
Le lundi 18 février 2019 17:50:01 UTC+1, [hidden email] a écrit :
> Le dimanche 17 février 2019 21:38:38 UTC+1, Salman Halim a écrit :
> > > 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.
> >
> >
> >
> > https://drive.google.com/open?id=1xPX4InUKhYEVrBuosfHqNk_SNRXY7PgT
> >
> >
> >
> > 1. Out of curiosity, what are the values of g:geometry#sessionfile and g:geometry#file?
> Ok rewrite the autoload vimscript as below : now jsut one session.
>
> > 2. Have you tried writing a separate session file out by hand right after doing the bufdo! bd! to see if it that session file contains anything different than the automatically generated one?
>
>
>
> > 3. Have you tried using bufwipe instead of bufdelete? bufdo! bw! (That's "stronger" than deleting a buffer.)
>
> Tried :bufdo! bw! out of :bufdo! bd! then :buffers returns only noname buffer
>
> Then I confirm the the attached mainsession.vim is written at vim leave.
>
> And on reload, buffers command list noname and mainsession.Vim
>
> > 4. The list of buffers is controlled through viminfo, not just sessions. What's the timestamp of your viminfo? Is it getting updated every time you quit? What are its contents? Could the buffer be coming back through that file?
> >
> :rviminfo says nothing.
>
>
> >
> > Here's the thing: I don't have the autocommands that you do. I also cannot reproduce what you're seeing. I remove all my buffers, write out the session file with an empty Vim (by hand), quit and come back. The first thing I do is execute ':buffers' to confirm it's still empty and then load the session file. My second call to :buffers is STILL empty. I also have no buffers or args in my session file.
> >
> > -- 
> >
> >  
> > Salman
> >
> > I, too, shall something make and glory in the making.
>
>
>
> autoload/geometry.vim
> let g:geometry#sessionfile=expand('$vimruntime/sessions/mainSession.vim')
>
> fun! geometry#SaveGeometry() "{{{
>
>   echo 'Save'
>   if !filereadable(g:geometry#sessionfile)
>       call mkdir(expand('$vimruntime/sessions'),0700)
>   endif
>   silent! execute 'mks! '.g:geometry#sessionfile
> endfunction "}}}
>
> fun! geometry#RestoreGeometry() "{{{
>
>   echo 'Restore'
>   if filereadable(g:geometry#sessionfile)
>       silent! execute 'source '.g:geometry#sessionfile       
>   endif
> endfunction "}}}

Solved, after some tests, it appears that sessionoptions in _vimrc need to be written like this :
set sessionoptions=buffers,help,resize,winpos,winsize,
instead of
set sessionoptions=buffers,help,resize,winpos,winsize

Otherwise, there is no restoration of winsize.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mksession restore just deleted buffer

Ni Va
Can you confirm this first?

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
12