[BACK]Return to option.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / vim

Diff for /src/usr.bin/vim/Attic/option.c between version 1.1 and 1.2

version 1.1, 1996/09/07 21:40:25 version 1.2, 1996/09/21 06:23:14
Line 194 
Line 194 
 #else  #else
 # if defined MSDOS  ||  defined WIN32  # if defined MSDOS  ||  defined WIN32
                                                         (char_u *)"%*[^\"]\"%f\"%*[^0-9]%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%m"},                                                          (char_u *)"%*[^\"]\"%f\"%*[^0-9]%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%m"},
 # elif defined(__EMX__) /* put most common here (i.e. gcc format) at front */  
                                                         (char_u *)"%f:%l:%m,%*[^\"]\"%f\"%*[^0-9]%l: %m,\"%f\"%*[^0-9]%l: %m"},  
 # else  # else
                                                         (char_u *)"%*[^\"]\"%f\"%*[^0-9]%l: %m,\"%f\"%*[^0-9]%l: %m,%f:%l:%m"},  #  if defined(__EMX__)  /* put most common here (i.e. gcc format) at front */
                                                           (char_u *)"%f:%l:%m,%*[^\"]\"%f\"%*[^0-9]%l: %m,\"%f\"%*[^0-9]%l: %m,%f(%l:%c) : %m"},
   #  else
   #   if defined(__QNX__)
                                                           (char_u *)"%f(%l):%*[^WE]%t%*[^0123456789]%n:%m"},
   #   else /* Unix, probably */
                                                           (char_u *)"%*[^\"]\"%f\"%*[^0-9]%l: %m,\"%f\"%*[^0-9]%l: %m,%f:%l:%m,\"%f\"\\, line %l%*[^0-9]%c%*[^ ] %m"},
   #   endif
   #  endif
 # endif  # endif
 #endif  #endif
         {"esckeys",             "ek",   P_BOOL,                         (char_u *)&p_ek,          {"esckeys",             "ek",   P_BOOL,                         (char_u *)&p_ek,
Line 236 
Line 242 
 #ifdef USE_GUI  #ifdef USE_GUI
                                                                                                 (char_u *)&p_guioptions,                                                                                                  (char_u *)&p_guioptions,
 # ifdef UNIX  # ifdef UNIX
                                                         (char_u *)"aAgmr"},                                                          (char_u *)"agmr"},
 # else  # else
                                                         (char_u *)"Agmr"},                                                          (char_u *)"gmr"},
 # endif  # endif
 #else  #else
                                                                                                 (char_u *)NULL,                                                                                                  (char_u *)NULL,
Line 395 
Line 401 
         {"path",                "pa",   P_STRING|P_EXPAND,      (char_u *)&p_path,          {"path",                "pa",   P_STRING|P_EXPAND,      (char_u *)&p_path,
 #if defined AMIGA  ||  defined MSDOS  ||  defined WIN32  #if defined AMIGA  ||  defined MSDOS  ||  defined WIN32
                                                         (char_u *)".,,"},                                                          (char_u *)".,,"},
 #elif defined(__EMX__)  
                                                         (char_u *)".,/emx/include,,"},  
 #else  #else
   # if defined(__EMX__)
                                                           (char_u *)".,/emx/include,,"},
   # else /* Unix, probably */
                                                         (char_u *)".,/usr/include,,"},                                                          (char_u *)".,/usr/include,,"},
   # endif
 #endif  #endif
         {"prompt",              NULL,   P_BOOL,                         (char_u *)NULL,          {"prompt",              NULL,   P_BOOL,                         (char_u *)NULL,
                                                         (char_u *)FALSE},                                                          (char_u *)FALSE},
Line 433 
Line 441 
         {"secure",              NULL,   P_BOOL,                         (char_u *)&p_secure,          {"secure",              NULL,   P_BOOL,                         (char_u *)&p_secure,
                                                         (char_u *)FALSE},                                                          (char_u *)FALSE},
         {"shell",               "sh",   P_STRING|P_EXPAND,      (char_u *)&p_sh,          {"shell",               "sh",   P_STRING|P_EXPAND,      (char_u *)&p_sh,
 #if   defined(MSDOS)  #if defined(MSDOS)
                                                         (char_u *)"command"},                                                          (char_u *)"command"},
 #elif defined(WIN32)  #else
   # if defined(WIN32)
                                                         (char_u *)""},          /* set in set_init_1() */                                                          (char_u *)""},          /* set in set_init_1() */
 #elif defined(__EMX__)  # else
   #  if defined(__EMX__)
                                                         (char_u *)"cmd.exe"},                                                          (char_u *)"cmd.exe"},
 #elif defined(ARCHIE)  #  else
   #   if defined(ARCHIE)
                                                         (char_u *)"gos"},                                                          (char_u *)"gos"},
 #else  #   else
                                                         (char_u *)"sh"},                                                          (char_u *)"sh"},
   #   endif
   #  endif
   # endif
 #endif  #endif
           {"shellcmdflag","shcf", P_STRING,           (char_u *)&p_shcf,
   #if defined(MSDOS) || defined(WIN32)
                                                           (char_u *)"/c"},
   #else
                                                           (char_u *)"-c"},
   #endif
         {"shellpipe",   "sp",   P_STRING,                       (char_u *)&p_sp,          {"shellpipe",   "sp",   P_STRING,                       (char_u *)&p_sp,
 #if defined(UNIX) || defined(OS2)  #if defined(UNIX) || defined(OS2)
 # ifdef ARCHIE  # ifdef ARCHIE
Line 454 
Line 474 
 #else  #else
                                                         (char_u *)">"},                                                          (char_u *)">"},
 #endif  #endif
           {"shellquote",  "shq",  P_STRING,           (char_u *)&p_shq,
                                                           (char_u *)""},
         {"shellredir",  "srr",  P_STRING,                       (char_u *)&p_srr,          {"shellredir",  "srr",  P_STRING,                       (char_u *)&p_srr,
                                                         (char_u *)">"},                                                          (char_u *)">"},
         {"shelltype",   "st",   P_NUM,                          (char_u *)&p_st,          {"shelltype",   "st",   P_NUM,                          (char_u *)&p_st,
Line 554 
Line 576 
                                                         (char_u *)1000L},                                                          (char_u *)1000L},
         {"title",               NULL,   P_BOOL,                         (char_u *)&p_title,          {"title",               NULL,   P_BOOL,                         (char_u *)&p_title,
                                                         (char_u *)FALSE},                                                          (char_u *)FALSE},
           {"titlelen",    NULL,   P_NUM,                          (char_u *)&p_titlelen,
                                                           (char_u *)85L},
         {"ttimeout",    NULL,   P_BOOL,                         (char_u *)&p_ttimeout,          {"ttimeout",    NULL,   P_BOOL,                         (char_u *)&p_ttimeout,
                                                         (char_u *)FALSE},                                                          (char_u *)FALSE},
         {"ttimeoutlen", "ttm",  P_NUM,                          (char_u *)&p_ttm,          {"ttimeoutlen", "ttm",  P_NUM,                          (char_u *)&p_ttm,
Line 1015 
Line 1039 
         }          }
 #endif  #endif
   
   #if defined(MSDOS) || defined(WIN32)
           /*
            * Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
            * This is done after other initializations, where 'shell' might have been
            * set, but only if they have not been set before.  Default for p_shcf is
            * "/c", for p_shq is "".  For "sh" like  shells it is changed here to
            * "-c" and "\"".
            */
           if (strstr((char *)p_sh, "sh") != NULL)
           {
                   idx1 = findoption((char_u *)"shcf");
                   if (!(options[idx1].flags & P_WAS_SET))
                   {
                           p_shcf = (char_u *)"-c";
                           options[idx1].def_val = p_shcf;
                   }
   
                   idx1 = findoption((char_u *)"shq");
                   if (!(options[idx1].flags & P_WAS_SET))
                   {
                           p_shq = (char_u *)"\"";
                           options[idx1].def_val = p_shq;
                   }
           }
   #endif
   
 /*  /*
  * 'title' and 'icon' only default to true if they have not been set or reset   * 'title' and 'icon' only default to true if they have not been set or reset
  * in .vimrc and we can read the old value.   * in .vimrc and we can read the old value.
  * When 'title' and 'icon' have been reset in .vimrc, we won't even check if   * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
  * they can be reset. this reduces startup time when using X on a remote   * they can be reset.  This reduces startup time when using X on a remote
  * machine.   * machine.
  */   */
         idx1 = findoption((char_u *)"title");          idx1 = findoption((char_u *)"title");
Line 1304 
Line 1354 
                                         else if (varp == (char_u *)&(curbuf->b_p_lisp))                                          else if (varp == (char_u *)&(curbuf->b_p_lisp))
                                                 init_chartab();         /* ignore errors */                                                  init_chartab();         /* ignore errors */
   
                                         else if (!starting && ((int *)varp == &p_title ||                                          else if (!starting &&
                                                                                                           (int *)varp == &p_icon))  #ifdef USE_GUI
                                                                   !gui.starting &&
   #endif
                                                     ((int *)varp == &p_title || (int *)varp == &p_icon))
                                         {                                          {
                                                 /*                                                  /*
                                                  * When setting 'title' or 'icon' on, call maketitle()                                                   * When setting 'title' or 'icon' on, call maketitle()
Line 1414 
Line 1467 
                                                 /* (re)set last window status line */                                                  /* (re)set last window status line */
                                                 if ((long *)varp == &p_ls)                                                  if ((long *)varp == &p_ls)
                                                         last_status();                                                          last_status();
                                                   if ((long *)varp == &p_titlelen && !starting)
                                                           maketitle();
                                         }                                          }
                                         else if (opt_idx >= 0)                                  /* string */                                          else if (opt_idx >= 0)                                  /* string */
                                         {                                          {
Line 1594 
Line 1649 
                                                                 }                                                                  }
                                                                 if (*s++ == NUL)                                                                  if (*s++ == NUL)
                                                                         errmsg = (char_u *)"Missing colon";                                                                          errmsg = (char_u *)"Missing colon";
                                                                 else if (*s == ',')                                                                  else if (*s == ',' || *s == NUL)
                                                                         errmsg = (char_u *)"Zero length string";                                                                          errmsg = (char_u *)"Zero length string";
                                                                 if (errmsg != NULL)                                                                  if (errmsg != NULL)
                                                                         break;                                                                          break;
Line 1811 
Line 1866 
                                 errmsg = e_positive;                                  errmsg = e_positive;
                                 p_tm = 0;                                  p_tm = 0;
                         }                          }
                           if (p_titlelen <= 0)
                           {
                                   errmsg = e_positive;
                                   p_titlelen = 85;
                           }
                         if ((curwin->w_p_scroll <= 0 ||                          if ((curwin->w_p_scroll <= 0 ||
                                                 curwin->w_p_scroll > curwin->w_height) && full_screen)                                                  curwin->w_p_scroll > curwin->w_height) && full_screen)
                         {                          {
Line 2585 
Line 2645 
   
 /*  /*
  * Copy options from one buffer to another.   * Copy options from one buffer to another.
  * Used when creating a new buffer and when entering a buffer.   * Used when creating a new buffer and sometimes when entering a buffer.
  * Only do this once for a new buffer, otherwise allocated memory for the  
  * string option will be lost.  
  * When "entering" is TRUE we will enter the bp_to buffer.   * When "entering" is TRUE we will enter the bp_to buffer.
    * When "always" is TRUE, always copy the options, but only set
    * b_p_initialized when appropriate.
  */   */
         void          void
 buf_copy_options(bp_from, bp_to, entering)  buf_copy_options(bp_from, bp_to, entering, always)
         BUF             *bp_from;          BUF             *bp_from;
         BUF             *bp_to;          BUF             *bp_to;
         int             entering;          int             entering;
           int             always;
 {  {
         /*          int             should_copy = TRUE;
          * Don't copy if one of the pointers is NULL or they are the same.  
          */  
         if (bp_from == NULL || bp_to == NULL || bp_from == bp_to)  
                 return;  
   
         /*          /*
          * Always copy when entering and 'cpo' contains 'S'.           * Don't do anything of the "to" buffer is invalid.
          * Don't copy when already initialized.  
          * Don't copy when 'cpo' contains 's' and not entering.  
          */           */
         if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !entering) &&          if (bp_to == NULL || !buf_valid(bp_to))
                         (bp_to->b_p_initialized ||  
                                                 (!entering && vim_strchr(p_cpo, CPO_BUFOPT) != NULL)))  
         {  
                 check_buf_options(bp_to);               /* make sure we don't have NULLs */  
                 return;                  return;
         }  
   
         /*          /*
          * If already initialized, need to free the allocated strings.           * Only copy if the "from" buffer is valid and "to" and "from" are
          * Copy 'readonly' and 'textmode' only when not initialized.           * different.
          */           */
         if (bp_to->b_p_initialized)          if (bp_from != NULL && buf_valid(bp_from) && bp_from != bp_to)
         {          {
                 free_string_option(bp_to->b_p_fo);                  /*
                 free_string_option(bp_to->b_p_isk);                   * Always copy when entering and 'cpo' contains 'S'.
                 free_string_option(bp_to->b_p_com);                   * Don't copy when already initialized.
 #ifdef CINDENT                   * Don't copy when 'cpo' contains 's' and not entering.
                 free_string_option(bp_to->b_p_cink);                   * 'S'  entering  initialized   's'  should_copy
                 free_string_option(bp_to->b_p_cino);                   * yes    yes          X         X      TRUE
 #endif                   * yes    no          yes        X      FALSE
 #if defined(CINDENT) || defined(SMARTINDENT)                   * no      X          yes        X      FALSE
                 free_string_option(bp_to->b_p_cinw);                   *  X     no          no        yes     FALSE
 #endif                   *  X     no          no        no      TRUE
         }                   * no     yes         no         X      TRUE
         else                   */
         {                  if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !entering) &&
                 bp_to->b_p_ro = FALSE;                          /* don't copy readonly */                                  (bp_to->b_p_initialized ||
                 bp_to->b_p_tx = bp_from->b_p_tx;                                   (!entering && vim_strchr(p_cpo, CPO_BUFOPT) != NULL)))
                 bp_to->b_p_tx_nobin = bp_from->b_p_tx_nobin;                          should_copy = FALSE;
         }  
   
         bp_to->b_p_ai = bp_from->b_p_ai;                  if (should_copy || always)
         bp_to->b_p_ai_save = bp_from->b_p_ai_save;                  {
         bp_to->b_p_sw = bp_from->b_p_sw;                          /*
         bp_to->b_p_tw = bp_from->b_p_tw;                           * Always free the allocated strings.
         bp_to->b_p_tw_save = bp_from->b_p_tw_save;                           * If not already initialized, set 'readonly' and copy 'textmode'.
         bp_to->b_p_tw_nobin = bp_from->b_p_tw_nobin;                           */
         bp_to->b_p_wm = bp_from->b_p_wm;                          free_buf_options(bp_to);
         bp_to->b_p_wm_save = bp_from->b_p_wm_save;                          if (!bp_to->b_p_initialized)
         bp_to->b_p_wm_nobin = bp_from->b_p_wm_nobin;                          {
         bp_to->b_p_bin = bp_from->b_p_bin;                                  bp_to->b_p_ro = FALSE;                          /* don't copy readonly */
         bp_to->b_p_et = bp_from->b_p_et;                                  bp_to->b_p_tx = bp_from->b_p_tx;
         bp_to->b_p_et_nobin = bp_from->b_p_et_nobin;                                  bp_to->b_p_tx_nobin = bp_from->b_p_tx_nobin;
         bp_to->b_p_ml = bp_from->b_p_ml;                          }
         bp_to->b_p_ml_nobin = bp_from->b_p_ml_nobin;  
         bp_to->b_p_inf = bp_from->b_p_inf;                          bp_to->b_p_ai = bp_from->b_p_ai;
                           bp_to->b_p_ai_save = bp_from->b_p_ai_save;
                           bp_to->b_p_sw = bp_from->b_p_sw;
                           bp_to->b_p_tw = bp_from->b_p_tw;
                           bp_to->b_p_tw_save = bp_from->b_p_tw_save;
                           bp_to->b_p_tw_nobin = bp_from->b_p_tw_nobin;
                           bp_to->b_p_wm = bp_from->b_p_wm;
                           bp_to->b_p_wm_save = bp_from->b_p_wm_save;
                           bp_to->b_p_wm_nobin = bp_from->b_p_wm_nobin;
                           bp_to->b_p_bin = bp_from->b_p_bin;
                           bp_to->b_p_et = bp_from->b_p_et;
                           bp_to->b_p_et_nobin = bp_from->b_p_et_nobin;
                           bp_to->b_p_ml = bp_from->b_p_ml;
                           bp_to->b_p_ml_nobin = bp_from->b_p_ml_nobin;
                           bp_to->b_p_inf = bp_from->b_p_inf;
 #ifndef SHORT_FNAME  #ifndef SHORT_FNAME
         bp_to->b_p_sn = bp_from->b_p_sn;                          bp_to->b_p_sn = bp_from->b_p_sn;
 #endif  #endif
         bp_to->b_p_com = strsave(bp_from->b_p_com);                          bp_to->b_p_com = strsave(bp_from->b_p_com);
         bp_to->b_p_fo = strsave(bp_from->b_p_fo);                          bp_to->b_p_fo = strsave(bp_from->b_p_fo);
 #ifdef SMARTINDENT  #ifdef SMARTINDENT
         bp_to->b_p_si = bp_from->b_p_si;                          bp_to->b_p_si = bp_from->b_p_si;
         bp_to->b_p_si_save = bp_from->b_p_si_save;                          bp_to->b_p_si_save = bp_from->b_p_si_save;
 #endif  #endif
 #ifdef CINDENT  #ifdef CINDENT
         bp_to->b_p_cin = bp_from->b_p_cin;                          bp_to->b_p_cin = bp_from->b_p_cin;
         bp_to->b_p_cin_save = bp_from->b_p_cin_save;                          bp_to->b_p_cin_save = bp_from->b_p_cin_save;
         bp_to->b_p_cink = strsave(bp_from->b_p_cink);                          bp_to->b_p_cink = strsave(bp_from->b_p_cink);
         bp_to->b_p_cino = strsave(bp_from->b_p_cino);                          bp_to->b_p_cino = strsave(bp_from->b_p_cino);
 #endif  #endif
 #if defined(SMARTINDENT) || defined(CINDENT)  #if defined(SMARTINDENT) || defined(CINDENT)
         bp_to->b_p_cinw = strsave(bp_from->b_p_cinw);                          bp_to->b_p_cinw = strsave(bp_from->b_p_cinw);
 #endif  #endif
 #ifdef LISPINDENT  #ifdef LISPINDENT
         bp_to->b_p_lisp = bp_from->b_p_lisp;                          bp_to->b_p_lisp = bp_from->b_p_lisp;
         bp_to->b_p_lisp_save = bp_from->b_p_lisp_save;                          bp_to->b_p_lisp_save = bp_from->b_p_lisp_save;
 #endif  #endif
         bp_to->b_p_ta_nobin = bp_from->b_p_ta_nobin;                          bp_to->b_p_ta_nobin = bp_from->b_p_ta_nobin;
   
         /*                          /*
          * Don't copy the options set by do_help(), use the saved values                           * Don't copy the options set by do_help(), use the saved values
          */                           */
         if (!keep_help_flag && bp_from->b_help && help_save_isk != NULL)                          if (!keep_help_flag && bp_from->b_help && help_save_isk != NULL)
         {                          {
                 bp_to->b_p_isk = strsave(help_save_isk);                                  bp_to->b_p_isk = strsave(help_save_isk);
                 if (bp_to->b_p_isk != NULL)                                  if (bp_to->b_p_isk != NULL)
                         init_chartab();                                          init_chartab();
                 bp_to->b_p_ts = help_save_ts;                                  bp_to->b_p_ts = help_save_ts;
                 bp_to->b_help = FALSE;                                  bp_to->b_help = FALSE;
                           }
                           else
                           {
                                   bp_to->b_p_isk = strsave(bp_from->b_p_isk);
                                   vim_memmove(bp_to->b_chartab, bp_from->b_chartab, (size_t)256);
                                   bp_to->b_p_ts = bp_from->b_p_ts;
                                   bp_to->b_help = bp_from->b_help;
                           }
                   }
   
                   /*
                    * When the options should be copied (ignoring "always"), set the flag
                    * that indicates that the options have been initialized.
                    */
                   if (should_copy)
                           bp_to->b_p_initialized = TRUE;
         }          }
         else  
         {  
                 bp_to->b_p_isk = strsave(bp_from->b_p_isk);  
                 vim_memmove(bp_to->b_chartab, bp_from->b_chartab, (size_t)256);  
                 bp_to->b_p_ts = bp_from->b_p_ts;  
                 bp_to->b_help = bp_from->b_help;  
         }  
         check_buf_options(bp_to);  
   
         /*          check_buf_options(bp_to);               /* make sure we don't have NULLs */
          * Set the flag that indicates that the options have been ininitialized.  
          * Avoids loosing allocated memory.  
          */  
         bp_to->b_p_initialized = TRUE;  
 }  }
   
   
 static int expand_option_idx = -1;  static int expand_option_idx = -1;
 static char_u expand_option_name[5] = {'t', '_', NUL, NUL, NUL};  static char_u expand_option_name[5] = {'t', '_', NUL, NUL, NUL};
   
Line 2856 
Line 2924 
         int     loop;          int     loop;
         int is_term_opt;          int is_term_opt;
         char_u  name_buf[MAX_KEY_NAME_LEN];          char_u  name_buf[MAX_KEY_NAME_LEN];
           int     save_reg_ic;
   
         /* do this loop twice:          /* do this loop twice:
          * loop == 0: count the number of matching options           * loop == 0: count the number of matching options
Line 2974 
Line 3043 
                                 STRCPY(name_buf + 1, str);                                  STRCPY(name_buf + 1, str);
                                 STRCAT(name_buf, ">");                                  STRCAT(name_buf, ">");
   
                                   save_reg_ic = reg_ic;
                                 reg_ic = TRUE;                                  /* ignore case here */                                  reg_ic = TRUE;                                  /* ignore case here */
                                 if (vim_regexec(prog, name_buf, TRUE))                                  if (vim_regexec(prog, name_buf, TRUE))
                                 {                                  {
Line 2982 
Line 3052 
                                         else                                          else
                                                 (*file)[count++] = strsave(name_buf);                                                  (*file)[count++] = strsave(name_buf);
                                 }                                  }
                                   reg_ic = save_reg_ic;
                         }                          }
                 }                  }
                 if (loop == 0)                  if (loop == 0)
Line 3243 
Line 3314 
 static char *event_nr2name __ARGS((int event));  static char *event_nr2name __ARGS((int event));
 static char_u *find_end_event __ARGS((char_u *arg));  static char_u *find_end_event __ARGS((char_u *arg));
 static int do_autocmd_event __ARGS((int event, char_u *pat,  static int do_autocmd_event __ARGS((int event, char_u *pat,
                                                                                                          char_u *cmd, int force));                                                                                                     char_u *cmd, int forceit));
   
         static void          static void
 show_autocmd(ap, event)  show_autocmd(ap, event)
Line 3412 
Line 3483 
  * :autocmd * *.c                               show all autocommands for *.c files.   * :autocmd * *.c                               show all autocommands for *.c files.
  */   */
         void          void
 do_autocmd(arg, force)  do_autocmd(arg, forceit)
         char_u  *arg;          char_u  *arg;
         int             force;          int             forceit;
 {  {
         char_u  *pat;          char_u  *pat;
         char_u  *cmd;          char_u  *cmd;
Line 3452 
Line 3523 
         /*          /*
          * Print header when showing autocommands.           * Print header when showing autocommands.
          */           */
         if (!force && *cmd == NUL)          if (!forceit && *cmd == NUL)
         {          {
                 set_highlight('t');             /* Highlight title */                  set_highlight('t');             /* Highlight title */
                 start_highlight();                  start_highlight();
Line 3466 
Line 3537 
         if (*arg == '*' || *arg == NUL)          if (*arg == '*' || *arg == NUL)
         {          {
                 for (event = 0; event < NUM_EVENTS; ++event)                  for (event = 0; event < NUM_EVENTS; ++event)
                         if (do_autocmd_event(event, pat, cmd, force) == FAIL)                          if (do_autocmd_event(event, pat, cmd, forceit) == FAIL)
                                 break;                                  break;
         }          }
         else          else
         {          {
                 while (*arg && !vim_iswhite(*arg))                  while (*arg && !vim_iswhite(*arg))
                         if (do_autocmd_event(event_name2nr(arg, &arg), pat,                          if (do_autocmd_event(event_name2nr(arg, &arg), pat,
                                                                                                                   cmd, force) == FAIL)                                                                                                                  cmd, forceit) == FAIL)
                                 break;                                  break;
         }          }
 }  }
Line 3482 
Line 3553 
  * do_autocmd() for one event.   * do_autocmd() for one event.
  * If *pat == NUL do for all patterns.   * If *pat == NUL do for all patterns.
  * If *cmd == NUL show entries.   * If *cmd == NUL show entries.
  * If force == TRUE delete entries.   * If forceit == TRUE delete entries.
  */   */
         static int          static int
 do_autocmd_event(event, pat, cmd, force)  do_autocmd_event(event, pat, cmd, forceit)
         int             event;          int             event;
         char_u  *pat;          char_u  *pat;
         char_u  *cmd;          char_u  *cmd;
         int             force;          int             forceit;
 {  {
         AutoPat         *ap;          AutoPat         *ap;
         AutoPat         *ap2;          AutoPat         *ap2;
Line 3508 
Line 3579 
                 for (ap = first_autopat[event]; ap != NULL; ap = ap2)                  for (ap = first_autopat[event]; ap != NULL; ap = ap2)
                 {                  {
                         ap2 = ap->next;                          ap2 = ap->next;
                         if (force)                          if (forceit)
                                 del_autocmd(ap);                                  del_autocmd(ap);
                         else                          else
                                 show_autocmd(ap, event);                                  show_autocmd(ap, event);
                 }                  }
                 if (force)                  if (forceit)
                         first_autopat[event] = NULL;                          first_autopat[event] = NULL;
         }          }
   
Line 3588 
Line 3659 
                  * If not adding any new autocmd's for this pattern, delete the                   * If not adding any new autocmd's for this pattern, delete the
                  * pattern from the autopat list                   * pattern from the autopat list
                  */                   */
                 else if (force)                  else if (forceit)
                 {                  {
                         del_autocmd_cmds(ap);                          del_autocmd_cmds(ap);
                         if (*cmd == NUL)                          if (*cmd == NUL)
Line 3610 
Line 3681 
                 /*                  /*
                  * Show autocmd's for this autopat                   * Show autocmd's for this autopat
                  */                   */
                 if (*cmd == NUL && !force)                  if (*cmd == NUL && !forceit)
                 {                  {
                         show_autocmd(ap, event);                          show_autocmd(ap, event);
                 }                  }
Line 3697 
Line 3768 
         AutoCmd                 *ac;          AutoCmd                 *ac;
         int                             temp;          int                             temp;
         int                             save_changed = curbuf->b_changed;          int                             save_changed = curbuf->b_changed;
           BUF                             *old_curbuf = curbuf;
         char_u                  *save_name;          char_u                  *save_name;
         char_u                  *full_fname = NULL;          char_u                  *full_fname = NULL;
         int                             retval = FALSE;          int                             retval = FALSE;
   
         if (autocmd_busy)                       /* no nesting allowed */          if (autocmd_busy)                       /* no nesting allowed */
                 return retval;                  return retval;
           /*
            * Check if these autocommands are disabled.  Used when doing ":all" or
            * ":ball".
            */
           if (    (autocmd_no_enter &&
                                   (event == EVENT_WINENTER || event == EVENT_BUFENTER)) ||
                           (autocmd_no_leave &&
                                   (event == EVENT_WINLEAVE || event == EVENT_BUFLEAVE)))
                   return retval;
   
                 /* Don't redraw while doing auto commands. */                  /* Don't redraw while doing auto commands. */
         temp = RedrawingDisabled;          temp = RedrawingDisabled;
Line 3735 
Line 3816 
   
         tail = gettail(fname);          tail = gettail(fname);
   
         for (ap = first_autopat[event]; ap != NULL; ap = ap->next)          for (ap = first_autopat[event]; ap != NULL && !got_int; ap = ap->next)
         {          {
 #ifdef CASE_INSENSITIVE_FILENAME  #ifdef CASE_INSENSITIVE_FILENAME
                 reg_ic = TRUE;          /* Always ignore case */                  reg_ic = TRUE;          /* Always ignore case */
Line 3760 
Line 3841 
                         vim_free(sourcing_name);                          vim_free(sourcing_name);
                 }                  }
                 vim_free(prog);                  vim_free(prog);
                   mch_breakcheck();
         }          }
         RedrawingDisabled = temp;          RedrawingDisabled = temp;
         autocmd_busy = FALSE;          autocmd_busy = FALSE;
Line 3767 
Line 3849 
         autocmd_fname = NULL;          autocmd_fname = NULL;
         vim_free(full_fname);          vim_free(full_fname);
   
         /* Some events don't set or reset the Changed flag */          /*
         if (event == EVENT_BUFREADPOST || event == EVENT_BUFWRITEPOST ||           * Some events don't set or reset the Changed flag.
                                          event == EVENT_FILEAPPENDPOST || event == EVENT_VIMLEAVE)           * Check if still in the same buffer!
            */
           if (curbuf == old_curbuf &&
                           (event == EVENT_BUFREADPOST || event == EVENT_BUFWRITEPOST ||
                           event == EVENT_FILEAPPENDPOST || event == EVENT_VIMLEAVE))
                 curbuf->b_changed = save_changed;                  curbuf->b_changed = save_changed;
   
         return retval;          return retval;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2