Loading ...
Sorry, an error occurred while loading the content.

RE: [PATCH] RE: Bug - :wa! behaviour

Expand Messages
  • Vince Negri
    This didn t seem to get through first time.. This appears to fix the :wa! behaviour... ... *************** autowrite(buf, forceit) *** 3231,3241 **** /* never
    Message 1 of 2 , Nov 29, 2000
    • 0 Attachment
      This didn't seem to get through first time..
      This appears to fix the :wa! behaviour...


      *** ex_docmd.c.orig Mon Nov 20 11:24:49 2000
      --- ex_docmd.c Wed Nov 29 10:06:45 2000
      *************** autowrite(buf, forceit)
      *** 3231,3241 ****
      /* never autowrite a "nofile" or "scratch" buffer */
      || bt_nofile(buf) || bt_scratch(buf)
      #endif
      || (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
      return FAIL;
      ! return buf_write_all(buf);
      }

      /*
      * flush all buffers, except the ones that are readonly
      */
      --- 3231,3241 ----
      /* never autowrite a "nofile" or "scratch" buffer */
      || bt_nofile(buf) || bt_scratch(buf)
      #endif
      || (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
      return FAIL;
      ! return buf_write_all(buf, forceit);
      }

      /*
      * flush all buffers, except the ones that are readonly
      */
      *************** autowrite_all()
      *** 3247,3257 ****
      if (!(p_aw || p_awa) || !p_write)
      return;
      for (buf = firstbuf; buf; buf = buf->b_next)
      if (bufIsChanged(buf) && !buf->b_p_ro)
      {
      ! (void)buf_write_all(buf);
      #ifdef FEAT_AUTOCMD
      /* an autocommand may have deleted the buffer */
      if (!buf_valid(buf))
      buf = firstbuf;
      #endif
      --- 3247,3257 ----
      if (!(p_aw || p_awa) || !p_write)
      return;
      for (buf = firstbuf; buf; buf = buf->b_next)
      if (bufIsChanged(buf) && !buf->b_p_ro)
      {
      ! (void)buf_write_all(buf, FALSE);
      #ifdef FEAT_AUTOCMD
      /* an autocommand may have deleted the buffer */
      if (!buf_valid(buf))
      buf = firstbuf;
      #endif
      *************** dialog_changed(buf, checkall)
      *** 3333,3343 ****
      #ifdef FEAT_BROWSE
      /* May get file name, when there is none */
      browse_save_fname(buf);
      #endif
      if (buf->b_fname != NULL) /* didn't hit Cancel */
      ! (void)buf_write_all(buf);
      }
      else if (ret == VIM_NO)
      {
      unchanged(buf, TRUE);
      }
      --- 3333,3343 ----
      #ifdef FEAT_BROWSE
      /* May get file name, when there is none */
      browse_save_fname(buf);
      #endif
      if (buf->b_fname != NULL) /* didn't hit Cancel */
      ! (void)buf_write_all(buf, FALSE);
      }
      else if (ret == VIM_NO)
      {
      unchanged(buf, TRUE);
      }
      *************** dialog_changed(buf, checkall)
      *** 3361,3371 ****
      #ifdef FEAT_BROWSE
      /* May get file name, when there is none */
      browse_save_fname(buf2);
      #endif
      if (buf2->b_fname != NULL) /* didn't hit Cancel */
      ! (void)buf_write_all(buf2);
      #ifdef FEAT_AUTOCMD
      /* an autocommand may have deleted the buffer */
      if (!buf_valid(buf2))
      buf2 = firstbuf;
      #endif
      --- 3361,3371 ----
      #ifdef FEAT_BROWSE
      /* May get file name, when there is none */
      browse_save_fname(buf2);
      #endif
      if (buf2->b_fname != NULL) /* didn't hit Cancel */
      ! (void)buf_write_all(buf2, FALSE);
      #ifdef FEAT_AUTOCMD
      /* an autocommand may have deleted the buffer */
      if (!buf_valid(buf2))
      buf2 = firstbuf;
      #endif
      *************** check_fname()
      *** 3511,3531 ****
      * flush the contents of a buffer, unless it has no file name
      *
      * return FAIL for failure, OK otherwise
      */
      int
      ! buf_write_all(buf)
      buf_t *buf;
      {
      int retval;
      #ifdef FEAT_AUTOCMD
      buf_t *old_curbuf = curbuf;
      #endif

      retval = (buf_write(buf, buf->b_ffname, buf->b_fname,
      (linenr_t)1, buf->b_ml.ml_line_count,
      NULL,
      ! FALSE, FALSE, TRUE,
      FALSE));
      #ifdef FEAT_AUTOCMD
      if (curbuf != old_curbuf)
      MSG(_("Warning: Entered other buffer unexpectedly (check
      autocommands)"));
      #endif
      return retval;
      --- 3511,3532 ----
      * flush the contents of a buffer, unless it has no file name
      *
      * return FAIL for failure, OK otherwise
      */
      int
      ! buf_write_all(buf, forceit)
      buf_t *buf;
      + int forceit;
      {
      int retval;
      #ifdef FEAT_AUTOCMD
      buf_t *old_curbuf = curbuf;
      #endif

      retval = (buf_write(buf, buf->b_ffname, buf->b_fname,
      (linenr_t)1, buf->b_ml.ml_line_count,
      NULL,
      ! FALSE, forceit, TRUE,
      FALSE));
      #ifdef FEAT_AUTOCMD
      if (curbuf != old_curbuf)
      MSG(_("Warning: Entered other buffer unexpectedly (check
      autocommands)"));
      #endif
      return retval;
      *** ex_cmds.c.orig Mon Nov 20 11:24:31 2000
      --- ex_cmds.c Wed Nov 29 10:06:59 2000
      *************** do_wqall(eap)
      *** 2134,2144 ****
      {
      ++error;
      }
      else
      {
      ! if (buf_write_all(buf) == FAIL)
      ++error;
      #ifdef FEAT_AUTOCMD
      /* an autocommand may have deleted the buffer */
      if (!buf_valid(buf))
      buf = firstbuf;
      --- 2134,2144 ----
      {
      ++error;
      }
      else
      {
      ! if (buf_write_all(buf, eap->forceit) == FAIL)
      ++error;
      #ifdef FEAT_AUTOCMD
      /* an autocommand may have deleted the buffer */
      if (!buf_valid(buf))
      buf = firstbuf;
      *** proto\ex_docmd.pro.orig Mon Nov 20 11:24:55 2000
      --- proto\ex_docmd.pro Wed Nov 29 10:11:13 2000
      ***************
      *** 10,20 ****
      int check_changed __ARGS((buf_t *buf, int checkaw, int mult_win, int
      forceit, int allbuf));
      void dialog_changed __ARGS((buf_t *buf, int checkall));
      int can_abandon __ARGS((buf_t *buf, int forceit));
      int check_changed_any __ARGS((int hidden));
      int check_fname __ARGS((void));
      ! int buf_write_all __ARGS((buf_t *buf));
      int rem_backslash __ARGS((char_u *str));
      void backslash_halve __ARGS((char_u *p));
      char_u *backslash_halve_save __ARGS((char_u *p));
      void check_arg_idx __ARGS((win_t *win));
      int ends_excmd __ARGS((int c));
      --- 10,20 ----
      int check_changed __ARGS((buf_t *buf, int checkaw, int mult_win, int
      forceit, int allbuf));
      void dialog_changed __ARGS((buf_t *buf, int checkall));
      int can_abandon __ARGS((buf_t *buf, int forceit));
      int check_changed_any __ARGS((int hidden));
      int check_fname __ARGS((void));
      ! int buf_write_all __ARGS((buf_t *buf, int forceit));
      int rem_backslash __ARGS((char_u *str));
      void backslash_halve __ARGS((char_u *p));
      char_u *backslash_halve_save __ARGS((char_u *p));
      void check_arg_idx __ARGS((win_t *win));
      int ends_excmd __ARGS((int c));


      --
      Vince Negri (vnegri@...)
      Application Solutions Ltd. Tel:+44(0)1273-476608 Fax:+44(0)1273-478888

      Legal Disclaimer: Any views expressed by the sender of this message are
      not necessarily those of Application Solutions Ltd. Information in this
      e-mail may be confidential and is for the use of the intended recipient
      only, no mistake in transmission is intended to waive or compromise such
      privilege. Please advise the sender if you receive this e-mail by mistake.
    Your message has been successfully submitted and would be delivered to recipients shortly.