Ian Taylor wrote:
> On Dec 5, 4:46 pm, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
> > Ian Taylor wrote:
> > > There seems to be some strange behavior when using the buftype=acwrite
> > > mode.
> >
> > > mkdir testdir
> > > vim
> >
> > > :set buftype=acwrite
> > > :autocmd BufWriteCmd <buffer> echo 'requested write'
> >
> > The file pattern is missing.
Sorry, <buffer> replaces the pattern here, so that is OK. But the
"echo" command doesn't write the buffer.
> > > :file testdir
> > > :w
> >
> > > This causes an error that 'testdir' already exists.
> >
> > > It works when I do
> > > :w!
> > > but, that doesn't seem like it should be necessary.
> >
> > > This seems like incorrect behavior since buftype=acwrite means that
> > > writes really take place by the autocmd. In my case, this involves
> > > network traffic and I don't care about the local filesystem at all.
> >
> > You must make sure yourself that the BufWriteCmd autocommand takes care
> > of the writing. See ":help E767".
>
> Well, in my example, the autocommand doesn't seem to be processed if
> the directory already exists (named the same thing as the buffer).
> That's the issue.
>
> Everything works as expected with my autocommand if there doesn't
> happen to be a local directory named the same as the buffer. It
> doesn't seem to me that it should matter what is in my current
> directory if I set the buftype to acwrite or nofile.
You are right, Vim should not use the buffer name as a file name, thus
not check if the file or directory exists. Try this patch:
*** ../vim-7.1.168/src/ex_cmds.c Tue Nov 20 18:03:34 2007
--- src/ex_cmds.c Fri Dec 7 13:38:39 2007
***************
*** 2732,2737 ****
--- 2732,2738 ----
&& vim_strchr(p_cpo, CPO_OVERNEW) == NULL)
|| (buf->b_flags & BF_READERR))
&& !p_wa
+ && !bt_nofile(buf)
&& vim_fexists(ffname))
{
if (!eap->forceit && !eap->append)
--
hundred-and-one symptoms of being an internet addict:
195. Your cat has its own home page.
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---