Sunday, February 28, 2010

Re: Any limitation of autocmd when the bufdo is processing ?

On Fri, Feb 26, 2010 at 3:41 PM, winterTTr <winterTTr.vim@gmail.com> wrote:
Actually, i meet a problem like below.
I tried to update a specific "unlisted" buffer every time the BufEnter event happens.

the Code like below( just an example, not the real code ):
I am trying to use the "set eventignore+=BufEnter" and "set eventignore-=BufEnter" to prevent the
process from running recursively.

--------------------------begin-----------------------------------
function! TestFunc()
    set eventignore+=BufEnter

    let bufname = bufname("%")
    " move to specific window
    2wincmd w
    " update buffer
    call append( 0 , bufname )
    " move back
    1wincmd w

    set eventignore-=BufEnter
endfunction

autocmd BufEnter * call TestFunc()
--------------------------end--------------------------------------

Everything is OK until i do the bufdo command. such as "bufdo s/^/1/"
"E474: Invalid argument: eventignore+=BufEnter" message is shown.

I can NOT find any information in the documentation showing any limitation during the bufdo command.
And I hope anyone could give the answer to the following question:
1. Is there a limitation that you can NOT set the variable "eventignore" during the bufdo process?
2. If so, is the "eventignore" the only one or are there any other variable that have the same limitation?
3. Someone told me that the ""set eventignore+=BufEnter" is unnecessary, cause the "bufdo" itself would
    prevent the recursive running ? Is this the truth ?

Anyone can give some idea ? :-)
 


If you really want to reproduce the error, i attach the file to do this. Please follow the next step:
1. source the test.vim
2. run a bufdo command, such as ""bufdo s/^/1/"
And , the error would be shown.

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

No comments: