On 2011-09-07, Gary Johnson wrote:
> On 2011-09-07, James Vega wrote:
> > On Wed, Sep 07, 2011 at 02:16:59PM -0700, Gary Johnson wrote:
> > > When a buffer is modified by a BufRead autocommand or by a filetype
> > > plugin, 'modified' is not set.
> > 
> > This is documented in the text below ":help gzip-example".
> > 
> >   The commands executed for the BufNewFile, BufRead/BufReadPost,
> >   BufWritePost, FileAppendPost and VimLeave events do not set or reset
> >   the changed flag of the buffer. ... If you do want the buffer to be
> >   marked as modified, set the 'modified' option.
> 
> Odd.  I would think it would be the other way around:  If an
> autocommand modifies a buffer and you don't want it marked as
> modified, set the 'nomodified' option.  That would follow the
> principle of least surprise.
> 
> I didn't think to look under ":help gzip-example" but I did read
> ":help 'modified'" a couple of times.
> 
> I think ":help 'modified'" should include an additional paragraph
> after item 2:
> 
>     This option is not set when a change is made as the result of a
>     BufNewFile, BufRead/BufReadPost, BufWritePost, FileAppendPost or
>     VimLeave autocommand event.
> 
> Thanks for the explanation and the pointer.

Here's a patch to options.txt that adds a paragraph explaining when
'modified' is not set.

Regards,
Gary

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
*** options.txt.orig    2011-09-07 12:39:19.923916000 -0700
--- options.txt 2011-09-08 14:34:44.277968000 -0700
***************
*** 4861,4866 ****
--- 4861,4870 ----
           written.  A ":set nomodified" command also resets the original
           values to the current values and the 'modified' option will be
           reset.
+       This option is not set when a change is made to the buffer as the
+       result of a BufNewFile, BufRead/BufReadPost, BufWritePost,
+       FileAppendPost or VimLeave autocommand event.  See |gzip-example| for
+       an explanation.
        When 'buftype' is "nowrite" or "nofile" this option may be set, but
        will be ignored.
  

Raspunde prin e-mail lui