src/nvim/fileio.c
/*
 * ":doautoall": execute autocommands for each loaded buffer.
 */
":doautoall": execute autocommands for each loaded buffer.
" : doautoall " : execute autocommands for each loaded buffer .
void ex_doautoall(exarg_T *eap)
{
  int retval;
  aco_save_T aco;
  char_u      *arg = eap->arg;
  int call_do_modelines = check_nomodeline(&arg);
  bufref_T bufref;
  FOR_ALL_BUFFERS(buf) {
    if (buf->b_ml.ml_mfp == NULL) {
      continue;
    }
    aucmd_prepbuf(&aco, buf);
    set_bufref(&bufref, buf);
    bool did_aucmd;
    retval = do_doautocmd(arg, false, &did_aucmd);
    if (call_do_modelines && did_aucmd) {
      do_modelines(curwin == aucmd_win ? OPT_NOWIN : 0);
    }
    aucmd_restbuf(&aco);
    if (retval == FAIL || !bufref_valid(&bufref)) {
      break;
    }
  }
  check_cursor();           
}
void ex_doautoall ( exarg_T * eap ) { int retval ; aco_save_T aco ; char_u * arg = eap -> arg ; int call_do_modelines = check_nomodeline ( & arg ) ; bufref_T bufref ; FOR_ALL_BUFFERS ( buf ) { if ( buf -> b_ml . ml_mfp == NULL ) { continue ; } aucmd_prepbuf ( & aco , buf ) ; set_bufref ( & bufref , buf ) ; bool did_aucmd ; retval = do_doautocmd ( arg , false , & did_aucmd ) ; if ( call_do_modelines && did_aucmd ) { do_modelines ( curwin == aucmd_win ? OPT_NOWIN : 0 ) ; } aucmd_restbuf ( & aco ) ; if ( retval == FAIL || ! bufref_valid ( & bufref ) ) { break ; } } check_cursor ( ) ; }
":doautoall": execute autocommands for each loaded buffer.
" : doautoall " : execute autocommands for each loaded buffer .
/*
   * This is a bit tricky: For some commands curwin->w_buffer needs to be
   * equal to curbuf, but for some buffers there may not be a window.
   * So we change the buffer for the current window for a moment.  This
   * gives problems when the autocommands make changes to the list of
   * buffers or windows...
   */ // Find a window for this buffer and save some values. // execute the autocommands for this buffer // Execute the modeline settings, but don't set window-local // options if we are using the current window for another // buffer. /* restore the current window */ // Stop if there is some error or buffer was deleted. /* just in case lines got deleted */