Loading ...
Sorry, an error occurred while loading the content.

RE: Cannot do :global recursive

Expand Messages
  • David Fishburn
    Ahh, I have figured out why this occurs now. Dr. Chip s script does this: /^-----/,$g/^ s* d/call GetLatestVimScripts() So he calls a function for each line
    Message 1 of 4 , Feb 5 8:28 PM
    • 0 Attachment
      Ahh, I have figured out why this occurs now.

      Dr. Chip's script does this:
      /^-----/,$g/^\s*\d/call GetLatestVimScripts()

      So he calls a function for each line found with the :g command.
      This will open a file, which fires the BufReadPost event which calls my
      function.

      My function issues:
      > > > execute "1," . last_line . 'g/' . pattern . "/let n = line('.')"

      Which results in the:
      > > > E147: Cannot do :global recursive

      So, I think I need to change my plugin to make it more forgiving.
      It is doing modeline checks for something like this:
      -- db_ext:dsnname=cons,type=ASA

      And then processes that line.

      So I want to check the first and last 5 (or &modeline) lines of a file.
      I was doing that with the command above.

      I figure I will rework the above code to use the search() function and check
      which line it finds it on.
      If anyone has alternate suggestions, I would appreciate hearing them.

      Thanks,
      Dave


      > -----Original Message-----
      > From: David Fishburn [mailto:fishburn@...]
      > Sent: Sunday, January 25, 2004 7:45 PM
      > To: vim@...
      > Subject: RE: Cannot do :global recursive
      >
      >
      > > On Thu, Jan 22, 2004 at 05:08:38PM -0500, David Fishburn wrote:
      > > >
      > > > Vim 6.2.180 WinXP
      > > >
      > > > I have a plugin that is reporting errors, I am trying to
      > figure out
      > > > why.
      > > >
      > > > execute "1," . last_line . 'g/' . pattern . "/let n = line('.')"
      > > > E147: Cannot do :global recursive
      > > >
      > > > If I replace the execute with echo I get:
      > > > >echo "1," . last_line . 'g/' . pattern . "/let n = line('.')"
      > > > 1,5g/dbext:/let n = line('.')
      > > >
      > > > This function is fired from an autocmd:
      > > > autocmd BufReadPost * if &modeline == 1 | call
      > > s:DB_checkModeline()
      > > > | endif
      > > >
      > > > There are:
      > > > >echo line('$')
      > > > 272
      > > >
      > > > So it is not a wrap issue.
      > >
      > > I tried an autocommand that calls a function that
      > > executes a :global command, with no problem. Do you still
      > > have the problem if you make s:DB_checkModeline() do nothing but
      > >
      > > :g/^/let g:n = line('.')
      > >
      > > or an :execute version of that? Do you still have a problem
      > > if you call
      > > s:DB_checkModeline() directly, instead of from an autocommand?
      >
      > Sorry, I was hoping this error message may just jump out at someone.
      >
      > I posted some months ago how DirDiff was generating an error.
      > Since then I have been re-writing part of one of my plugins,
      > and to my chagrin have realized that the DirDiff problem was
      > caused by my own plugin. I was never able to isolate why it
      > was a problem, but managed to work around the issue.
      >
      > I have been using this code for quite sometime, it has never
      > caused problems in any of situations. So the code itself
      > fires everytime a new buffer is opened, that means it has
      > been firing constantly for months. This is a new instance of
      > a problem.
      >
      > The most recent problem has occurred when I ran Dr. Chip's
      > script: GetLatestVimScripts.vim. It will report this error
      > everytime I run that script.
      >
      > I am not sure if it makes special mode changes that might
      > cause this problems.
      >
      > I ran SET from within the debugger:
      >
      > *** First from within GetLatestVimScripts.vim. *******
      >
      > --- Options ---
      > autoindent hlsearch scroll=26 notextmode
      > background=dark ignorecase scrolloff=2
      > nottybuiltin
      > diffexpr=MyDiff() incsearch shiftwidth=4
      > ttyscroll=0
      > expandtab laststatus=2 shortmess=at
      > visualbell
      > fileformat=unix lazyredraw showbreak=>>
      > whichwrap=<,>,h,l
      > grepprg=grep -Hin makeprg=javac % showmatch
      > wildcharm=^Z
      > hidden norestorescreen smartcase wildmenu
      > history=500 ruler nostartofline
      > nowritebackup
      > backspace=indent,eol,start
      > comments=b:#,:%,n:>
      > errorformat=%A%f:%l: %m,%-Z%p^,%-C%.%#
      > fileformats=unix,dos
      > foldopen=block,hor,mark,percent,quickfix,search,tag,undo,jump
      > formatoptions=cqrton
      > listchars=eol:$,tab:» ,eol:¶,trail:·,extends:…,precedes:…
      > rulerformat=%45(%{<SNR>54_P4RulerStatus()}%=%l,%c%V%=%5(%p%%%)%)
      > shell=c:\windows\system32\cmd.exe
      > shellpipe=> %s 2>&1
      > viminfo="50,'1000,h,f1,rA:,:500,/500,%,!,n$VIM/_viminfo
      >
      >
      >
      > *** Second from within some .vim script *******
      > --- Options ---
      > autoindent hlsearch scrolloff=2
      > textwidth=78
      > background=dark ignorecase shiftwidth=4
      > nottybuiltin
      > diffexpr=MyDiff() incsearch shortmess=at
      > ttyscroll=0
      > expandtab laststatus=2 showbreak=>>
      > visualbell
      > fileformat=unix lines=55 showmatch
      > whichwrap=<,>,h,l
      > filetype=vim makeprg=javac % smartcase
      > wildcharm=^Z
      > grepprg=grep -Hin modified nostartofline wildmenu
      > hidden ruler syntax=vim
      > nowritebackup
      > history=500 scroll=26 notextmode
      > backspace=indent,eol,start
      > comments=sO:" -,mO:" ,eO:"",:"
      > errorformat=%A%f:%l: %m,%-Z%p^,%-C%.%#
      > fileformats=unix,dos
      > foldopen=block,hor,mark,percent,quickfix,search,tag,undo,jump
      > formatoptions=ncroql
      > indentexpr=GetVimIndent()
      > indentkeys=0{,0},:,0#,!^F,o,O,e,=end,=else,=cat,=fina,=END,0\
      > listchars=eol:$,tab:» ,eol:¶,trail:·,extends:…,precedes:…
      > rulerformat=%45(%{<SNR>54_P4RulerStatus()}%=%l,%c%V%=%5(%p%%%)%)
      > shell=c:\windows\system32\cmd.exe
      > shellpipe=> %s 2>&1
      > viminfo="50,'1000,h,f1,rA:,:500,/500,%,!,n$VIM/_viminfo
      >
      > Can you think of anything I might also look into.
      >
      > Thanks,
      > Dave
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.