I wrote:

> Gary Johnson wrote:
> 
> > In a directory containing a simple text file named 'mary', execute
> > the following:
> > 
> >     $ vim -u NONE -i NONE
> >     :r mary
> > 
> > The result is the following two error messages:
> > 
> >     E812: Autocommands changed buffer or buffer name
> >     E484: Can't open file mary
> > 
> > I don't know what autocommand that could be since I started Vim
> > without plugins and :scriptnames shows nothing.
> > 
> > This works without error if Vim is started in 'noncompatible' mode
> > or when using Vim 6.3.
> 
> I can reproduce it.  Strange that nobody noticed until now.
> 
> I'll fix it ASAP.

It was most likely introduced by patch 7.2.132, sent out March 5 2009.

This patch should fix it, please verify it doesn't introduce any new
problems:


--- a/src/fileio.c      2010-08-08 18:45:40.000000000 +0200
+++ b/src/fileio.c      2010-08-14 14:20:54.000000000 +0200
@@ -317,20 +317,14 @@
     char_u     conv_rest[CONV_RESTLEN];
     int                conv_restlen = 0;       /* nr of bytes in conv_rest[] */
 #endif
-
 #ifdef FEAT_AUTOCMD
-    /* Remember the initial values of curbuf, curbuf->b_ffname and
-     * curbuf->b_fname to detect whether they are altered as a result of
-     * executing nasty autocommands.  Also check if "fname" and "sfname"
-     * point to one of these values. */
-    buf_T   *old_curbuf = curbuf;
-    char_u  *old_b_ffname = curbuf->b_ffname;
-    char_u  *old_b_fname = curbuf->b_fname;
-    int     using_b_ffname = (fname == curbuf->b_ffname)
-                                             || (sfname == curbuf->b_ffname);
-    int     using_b_fname = (fname == curbuf->b_fname)
-                                              || (sfname == curbuf->b_fname);
+    buf_T      *old_curbuf;
+    char_u     *old_b_ffname;
+    char_u     *old_b_fname;
+    int                using_b_ffname;
+    int                using_b_fname;
 #endif
+
     write_no_eol_lnum = 0;     /* in case it was set by the previous read */
 
     /*
@@ -349,6 +343,19 @@
            return FAIL;
     }
 
+#ifdef FEAT_AUTOCMD
+    /* Remember the initial values of curbuf, curbuf->b_ffname and
+     * curbuf->b_fname to detect whether they are altered as a result of
+     * executing nasty autocommands.  Also check if "fname" and "sfname"
+     * point to one of these values. */
+    old_curbuf = curbuf;
+    old_b_ffname = curbuf->b_ffname;
+    old_b_fname = curbuf->b_fname;
+    using_b_ffname = (fname == curbuf->b_ffname)
+                                             || (sfname == curbuf->b_ffname);
+    using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname);
+#endif
+
     /* After reading a file the cursor line changes but we don't want to
      * display the line. */
     ex_no_reprint = TRUE;

-- 
hundred-and-one symptoms of being an internet addict:
66. You create a homepage with the impression to cure the afflicted...but
    your hidden agenda is to receive more e-mail.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui