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

Re: E676 error in Vim7 when writing contents of a 'nofile' buffer to a file

Expand Messages
  • Stahlman Family
    ... From: Bram Moolenaar To: Stahlman Family Cc: A. J. Mechelynck ;
    Message 1 of 10 , Mar 31, 2005
      ----- Original Message -----
      From: "Bram Moolenaar" <Bram@...>
      To: "Stahlman Family" <brettstahlman@...>
      Cc: "A. J. Mechelynck" <antoine.mechelynck@...>; <vim@...>
      Sent: Thursday, March 31, 2005 2:12 AM
      Subject: Re: E676 error in Vim7 when writing contents of a 'nofile' buffer
      to a file


      >
      > Brett Stahlman wrote:
      >
      >> I believe the apparent bug/unexpected behavior, which I originally
      >> reported, is due to the following code (a bit later in buf_write()):
      >> (pseudo code only...)
      >>
      >> else if (reset_changed && whole)
      >> if(!(did_cmd = apply_autocommands_exarg(EVENT_BUFWRITECMD, ...)
      >> if(bt_nofile(curbuf))
      >> nofile_err = TRUE;
      >>
      >> The problem is that this logic requires BUFWRITECMD autocommands not
      >> just for acwrite buffer but also for nofile buffer. Help does not
      >> suggest that BUFWRITECMD autocommands need to be defined for 'nofile'
      >> buffers.
      >>
      >> Help on 'buftype' states the following for both nofile and acwrite
      >> cases:
      >>
      >> The buffer is not to be written to disk, ":w" doesn't work (":w
      >> filename" does work though).
      >>
      >> It appears that even with the patch, the claim in parentheses is
      >> wrong...
      >
      > This looks like an older Vim 7. The code now looks like this:

      Ah. My mistake. I am indeed using an older Vim 7. I'll download the latest.

      Thanks,
      Brett Stahlman
      >
      > else if (reset_changed && whole)
      > {
      > if (!(did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD,
      > sfname, sfname, FALSE, curbuf, eap)))
      > {
      > if (overwriting && bt_nofile(curbuf))
      > nofile_err = TRUE;
      >
      > The "overwriting" flag is set for ":w" but not for ":w filename".
      >
      > --
      > hundred-and-one symptoms of being an internet addict:
      > 37. You start looking for hot HTML addresses in public restrooms.
      >
      > /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      > /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
      > \\\
      > \\\ Project leader for A-A-P -- http://www.A-A-P.org
      > ///
      > \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.