comparison src/fileio.c @ 2563:5769dc787ec5 vim73

Fix: in compatible mode, in an empty buffer, ":r file" triggered an error message.
author Bram Moolenaar <bram@vim.org>
date Sat, 14 Aug 2010 14:32:54 +0200
parents 0dffdd8f8871
children 033e7b49356c
comparison
equal deleted inserted replaced
2562:19f4f5ee3d1f 2563:5769dc787ec5
315 int notconverted = FALSE; /* TRUE if conversion wanted but it 315 int notconverted = FALSE; /* TRUE if conversion wanted but it
316 wasn't possible */ 316 wasn't possible */
317 char_u conv_rest[CONV_RESTLEN]; 317 char_u conv_rest[CONV_RESTLEN];
318 int conv_restlen = 0; /* nr of bytes in conv_rest[] */ 318 int conv_restlen = 0; /* nr of bytes in conv_rest[] */
319 #endif 319 #endif
320
321 #ifdef FEAT_AUTOCMD 320 #ifdef FEAT_AUTOCMD
322 /* Remember the initial values of curbuf, curbuf->b_ffname and 321 buf_T *old_curbuf;
323 * curbuf->b_fname to detect whether they are altered as a result of 322 char_u *old_b_ffname;
324 * executing nasty autocommands. Also check if "fname" and "sfname" 323 char_u *old_b_fname;
325 * point to one of these values. */ 324 int using_b_ffname;
326 buf_T *old_curbuf = curbuf; 325 int using_b_fname;
327 char_u *old_b_ffname = curbuf->b_ffname; 326 #endif
328 char_u *old_b_fname = curbuf->b_fname; 327
329 int using_b_ffname = (fname == curbuf->b_ffname)
330 || (sfname == curbuf->b_ffname);
331 int using_b_fname = (fname == curbuf->b_fname)
332 || (sfname == curbuf->b_fname);
333 #endif
334 write_no_eol_lnum = 0; /* in case it was set by the previous read */ 328 write_no_eol_lnum = 0; /* in case it was set by the previous read */
335 329
336 /* 330 /*
337 * If there is no file name yet, use the one for the read file. 331 * If there is no file name yet, use the one for the read file.
338 * BF_NOTEDITED is set to reflect this. 332 * BF_NOTEDITED is set to reflect this.
346 && !(flags & READ_DUMMY)) 340 && !(flags & READ_DUMMY))
347 { 341 {
348 if (set_rw_fname(fname, sfname) == FAIL) 342 if (set_rw_fname(fname, sfname) == FAIL)
349 return FAIL; 343 return FAIL;
350 } 344 }
345
346 #ifdef FEAT_AUTOCMD
347 /* Remember the initial values of curbuf, curbuf->b_ffname and
348 * curbuf->b_fname to detect whether they are altered as a result of
349 * executing nasty autocommands. Also check if "fname" and "sfname"
350 * point to one of these values. */
351 old_curbuf = curbuf;
352 old_b_ffname = curbuf->b_ffname;
353 old_b_fname = curbuf->b_fname;
354 using_b_ffname = (fname == curbuf->b_ffname)
355 || (sfname == curbuf->b_ffname);
356 using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname);
357 #endif
351 358
352 /* After reading a file the cursor line changes but we don't want to 359 /* After reading a file the cursor line changes but we don't want to
353 * display the line. */ 360 * display the line. */
354 ex_no_reprint = TRUE; 361 ex_no_reprint = TRUE;
355 362