4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Resetting 'modified' in a StdinReadPost autocommand doesn't work.
12 Solution: Set 'modified' before the autocommands instead of after it.
16 *** ../vim-7.1.005/src/buffer.c Thu May 10 18:43:46 2007
17 --- src/buffer.c Fri Jun 8 20:59:04 2007
21 /* Put the cursor on the first line. */
22 curwin->w_cursor.lnum = 1;
23 curwin->w_cursor.col = 0;
25 + /* Set or reset 'modified' before executing autocommands, so that
26 + * it can be changed there. */
27 + if (!readonlymode && !bufempty())
29 + else if (retval != FAIL)
30 + unchanged(curbuf, FALSE);
33 apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
36 /* When reading stdin, the buffer contents always needs writing, so set
37 * the changed flag. Unless in readonly mode: "ls | gview -".
38 * When interrupted and 'cpoptions' contains 'i' set changed flag. */
39 ! if ((read_stdin && !readonlymode && !bufempty())
41 || modified_was_set /* ":set modified" used in autocmd */
43 || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
46 ! || (got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL))
48 ! else if (retval != FAIL)
49 unchanged(curbuf, FALSE);
50 save_file_ff(curbuf); /* keep this fileformat */
53 /* When reading stdin, the buffer contents always needs writing, so set
54 * the changed flag. Unless in readonly mode: "ls | gview -".
55 * When interrupted and 'cpoptions' contains 'i' set changed flag. */
56 ! if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
58 || modified_was_set /* ":set modified" used in autocmd */
60 || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
65 ! else if (retval != FAIL && !read_stdin)
66 unchanged(curbuf, FALSE);
67 save_file_ff(curbuf); /* keep this fileformat */
69 *** ../vim-7.1.005/src/version.c Tue Jun 19 12:58:55 2007
70 --- src/version.c Tue Jun 19 15:37:53 2007
74 { /* Add new patch number below this line */
80 If I tell you "you have a beautiful body", would you hold it against me?
82 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
83 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
84 \\\ download, build and distribute -- http://www.A-A-P.org ///
85 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///