2015-03-07 17:04 GMT+03:00 Bram Moolenaar <[email protected]>:
>
> 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:…`.

>
> --
> Not too long ago, unzipping in public was illegal...
>
>  /// 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