comparison src/fileio.c @ 1723:2e42153b37f1 v7.2.021

updated for version 7.2-021
author vimboss
date Thu, 18 Sep 2008 19:29:58 +0000
parents f4f8014d516e
children 5a7384b9ca66
comparison
equal deleted inserted replaced
1722:5950b03fc906 1723:2e42153b37f1
8521 buf_T *old_curbuf; 8521 buf_T *old_curbuf;
8522 int retval = FALSE; 8522 int retval = FALSE;
8523 char_u *save_sourcing_name; 8523 char_u *save_sourcing_name;
8524 linenr_T save_sourcing_lnum; 8524 linenr_T save_sourcing_lnum;
8525 char_u *save_autocmd_fname; 8525 char_u *save_autocmd_fname;
8526 int save_autocmd_fname_full;
8526 int save_autocmd_bufnr; 8527 int save_autocmd_bufnr;
8527 char_u *save_autocmd_match; 8528 char_u *save_autocmd_match;
8528 int save_autocmd_busy; 8529 int save_autocmd_busy;
8529 int save_autocmd_nested; 8530 int save_autocmd_nested;
8530 static int nesting = 0; 8531 static int nesting = 0;
8599 8600
8600 /* 8601 /*
8601 * Save the autocmd_* variables and info about the current buffer. 8602 * Save the autocmd_* variables and info about the current buffer.
8602 */ 8603 */
8603 save_autocmd_fname = autocmd_fname; 8604 save_autocmd_fname = autocmd_fname;
8605 save_autocmd_fname_full = autocmd_fname_full;
8604 save_autocmd_bufnr = autocmd_bufnr; 8606 save_autocmd_bufnr = autocmd_bufnr;
8605 save_autocmd_match = autocmd_match; 8607 save_autocmd_match = autocmd_match;
8606 save_autocmd_busy = autocmd_busy; 8608 save_autocmd_busy = autocmd_busy;
8607 save_autocmd_nested = autocmd_nested; 8609 save_autocmd_nested = autocmd_nested;
8608 save_changed = curbuf->b_changed; 8610 save_changed = curbuf->b_changed;
8616 if (fname_io == NULL) 8618 if (fname_io == NULL)
8617 { 8619 {
8618 if (fname != NULL && *fname != NUL) 8620 if (fname != NULL && *fname != NUL)
8619 autocmd_fname = fname; 8621 autocmd_fname = fname;
8620 else if (buf != NULL) 8622 else if (buf != NULL)
8621 autocmd_fname = buf->b_fname; 8623 autocmd_fname = buf->b_ffname;
8622 else 8624 else
8623 autocmd_fname = NULL; 8625 autocmd_fname = NULL;
8624 } 8626 }
8625 else 8627 else
8626 autocmd_fname = fname_io; 8628 autocmd_fname = fname_io;
8627 if (autocmd_fname != NULL) 8629 if (autocmd_fname != NULL)
8628 autocmd_fname = FullName_save(autocmd_fname, FALSE); 8630 autocmd_fname = vim_strsave(autocmd_fname);
8631 autocmd_fname_full = FALSE; /* call FullName_save() later */
8629 8632
8630 /* 8633 /*
8631 * Set the buffer number to be used for <abuf>. 8634 * Set the buffer number to be used for <abuf>.
8632 */ 8635 */
8633 if (buf == NULL) 8636 if (buf == NULL)
8808 vim_free(sourcing_name); 8811 vim_free(sourcing_name);
8809 sourcing_name = save_sourcing_name; 8812 sourcing_name = save_sourcing_name;
8810 sourcing_lnum = save_sourcing_lnum; 8813 sourcing_lnum = save_sourcing_lnum;
8811 vim_free(autocmd_fname); 8814 vim_free(autocmd_fname);
8812 autocmd_fname = save_autocmd_fname; 8815 autocmd_fname = save_autocmd_fname;
8816 autocmd_fname_full = save_autocmd_fname_full;
8813 autocmd_bufnr = save_autocmd_bufnr; 8817 autocmd_bufnr = save_autocmd_bufnr;
8814 autocmd_match = save_autocmd_match; 8818 autocmd_match = save_autocmd_match;
8815 #ifdef FEAT_EVAL 8819 #ifdef FEAT_EVAL
8816 current_SID = save_current_SID; 8820 current_SID = save_current_SID;
8817 restore_funccal(save_funccalp); 8821 restore_funccal(save_funccalp);
8916 8920
8917 for (ap = apc->curpat; ap != NULL && !got_int; ap = ap->next) 8921 for (ap = apc->curpat; ap != NULL && !got_int; ap = ap->next)
8918 { 8922 {
8919 apc->curpat = NULL; 8923 apc->curpat = NULL;
8920 8924
8921 /* only use a pattern when it has not been removed, has commands and 8925 /* Only use a pattern when it has not been removed, has commands and
8922 * the group matches. For buffer-local autocommands only check the 8926 * the group matches. For buffer-local autocommands only check the
8923 * buffer number. */ 8927 * buffer number. */
8924 if (ap->pat != NULL && ap->cmds != NULL 8928 if (ap->pat != NULL && ap->cmds != NULL
8925 && (apc->group == AUGROUP_ALL || apc->group == ap->group)) 8929 && (apc->group == AUGROUP_ALL || apc->group == ap->group))
8926 { 8930 {