ZyX wrote:

> >> Consider the following code:
> >>
> >>     % vim -u NONE -i NONE --cmd 'autocmd BufReadCmd edit://foo :call 
> >> setline(".", "foo")|setlocal buftype=nofile' -c 'edit edit://foo' -c 
> >> 'mksession ses.vim' -c qall!
> >>     % vim -u NONE -i NONE --cmd 'autocmd BufReadCmd edit://foo :call 
> >> setline(".", "foo")|setlocal buftype=nofile' -S ses.vim
> >>
> >> . This will show you the empty buffer in the second Vim instance with an 
> >> empty name. But the following code:
> >>
> >>     % vim -u NONE -i NONE --cmd 'autocmd BufReadCmd edit://foo :call 
> >> setline(".", "foo")|setlocal buftype=nofile' -c 'edit edit://foo' -c 'edit 
> >> bar' -c 'mksession ses.vim' -c qall!
> >>     % vim -u NONE -i NONE --cmd 'autocmd BufReadCmd edit://foo :call 
> >> setline(".", "foo")|setlocal buftype=nofile' -S ses.vim -c bnext
> >>
> >> (additions: `-c 'edit bar'` in first command, `-c bnext` in the second) 
> >> will show you buffer with `foo` on the first line.
> >
> > I find it a bit difficult to see what the problem is without actually
> > executing the commands.  Perhaps you can point to the lines in the
> > session file that are not correct?
> 
> With `buftype=nofile` Vim will execute `badd +0 edit://foo`, then some
> stuff, then `file edit://foo`. Neither of these commands launches
> BufReadCmd event. With other &buftype it will execute `badd +0
> edit://foo`, then `edit edit://foo` which launches BufReadCmd.
> 
> Note: `nofile` was preferred over `nowrite` because with `nofile`
> buffer name is not handled like a file name. Actual buffer name is
> something like `aurum://diff:…`.

OK, so we have a "nofile" buffer for which we would want to use the
":edit" command, so that the BufReadCmd gets triggered.  But "nofile"
basically means that one can't use ":edit".  So how about using
":doauto BufReadCmd {fname}"?  Can you put that in the session file to
check if it works?  Once we know the right command it should be easy to
add it to the session file writing.

-- 
Q:  Why do ducks have flat feet?
A:  To stamp out forest fires.

Q:  Why do elephants have flat feet?
A:  To stamp out flaming ducks.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui