Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 293 by [email protected]: bdelete/bwipeout in BufNewFile/BufReadPost autocmd breaks `vim -[poO]`
https://code.google.com/p/vim/issues/detail?id=293

Given the following rc file:

% cat test_vimrc.vim
fun! BufReadPost()
  let bufname=bufname('%')
  echomsg bufname
  if bufname[-1:] == ':'
    echomsg "EDIT"
    let bufnr = bufnr('%')
    exec 'edit' bufname[0:-2]
    exec 'bwipeout' bufnr
  endif
endfun
autocmd BufNewFile,BufReadPost * call BufReadPost()

This command fails:

    % vim -N -u test_vimrc.vim -p foo: bar baz -c '3tabclose | qa'
    3 files to edit
    "foo" [New File]
    Error detected while processing command line:
    E784: Cannot close last tab page
    Press ENTER or type command to continue

Using `bufhidden=wipe` instead of `bwipeout` works for `vim -p`, but not for
`-o`.

I could imagine that the pointer to the current buffer needs special
handling/restoring in this case, after the BufNewFile/BufReadPost autocommand has
been called.

The use case is handling `file:line` patterns, in the file_line plugin
(https://github.com/bogado/file-line).
See https://github.com/bogado/file-line/pull/37 for a pull request where this
is discussed.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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