|
Karsten Hopp |
4f31f7 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
4f31f7 |
Subject: Patch 7.3.442
|
|
Karsten Hopp |
4f31f7 |
Fcc: outbox
|
|
Karsten Hopp |
4f31f7 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
4f31f7 |
Mime-Version: 1.0
|
|
Karsten Hopp |
4f31f7 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
4f31f7 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
4f31f7 |
------------
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
Patch 7.3.442 (after 7.3.438)
|
|
Karsten Hopp |
4f31f7 |
Problem: Still read modelines for ":doautocmd".
|
|
Karsten Hopp |
4f31f7 |
Solution: Move check for <nomodeline> to separate function.
|
|
Karsten Hopp |
4f31f7 |
Files: src/fileio.c, src/ex_docmd.c, src/proto/fileio.pro,
|
|
Karsten Hopp |
4f31f7 |
runtime/doc/autocmd.txt
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
*** ../vim-7.3.441/src/fileio.c 2012-02-12 00:18:54.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
--- src/fileio.c 2012-02-12 20:05:35.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
***************
|
|
Karsten Hopp |
4f31f7 |
*** 8740,8752 ****
|
|
Karsten Hopp |
4f31f7 |
aco_save_T aco;
|
|
Karsten Hopp |
4f31f7 |
buf_T *buf;
|
|
Karsten Hopp |
4f31f7 |
char_u *arg = eap->arg;
|
|
Karsten Hopp |
4f31f7 |
! int call_do_modelines = TRUE;
|
|
Karsten Hopp |
4f31f7 |
!
|
|
Karsten Hopp |
4f31f7 |
! if (STRNCMP(arg, "<nomodeline>", 12) == 0)
|
|
Karsten Hopp |
4f31f7 |
! {
|
|
Karsten Hopp |
4f31f7 |
! call_do_modelines = FALSE;
|
|
Karsten Hopp |
4f31f7 |
! arg = skipwhite(arg + 12);
|
|
Karsten Hopp |
4f31f7 |
! }
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
/*
|
|
Karsten Hopp |
4f31f7 |
* This is a bit tricky: For some commands curwin->w_buffer needs to be
|
|
Karsten Hopp |
4f31f7 |
--- 8740,8746 ----
|
|
Karsten Hopp |
4f31f7 |
aco_save_T aco;
|
|
Karsten Hopp |
4f31f7 |
buf_T *buf;
|
|
Karsten Hopp |
4f31f7 |
char_u *arg = eap->arg;
|
|
Karsten Hopp |
4f31f7 |
! int call_do_modelines = check_nomodeline(&arg;;
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
/*
|
|
Karsten Hopp |
4f31f7 |
* This is a bit tricky: For some commands curwin->w_buffer needs to be
|
|
Karsten Hopp |
4f31f7 |
***************
|
|
Karsten Hopp |
4f31f7 |
*** 8786,8791 ****
|
|
Karsten Hopp |
4f31f7 |
--- 8780,8802 ----
|
|
Karsten Hopp |
4f31f7 |
}
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
/*
|
|
Karsten Hopp |
4f31f7 |
+ * Check *argp for <nomodeline>. When it is present return FALSE, otherwise
|
|
Karsten Hopp |
4f31f7 |
+ * return TRUE and advance *argp to after it.
|
|
Karsten Hopp |
4f31f7 |
+ * Thus return TRUE when do_modelines() should be called.
|
|
Karsten Hopp |
4f31f7 |
+ */
|
|
Karsten Hopp |
4f31f7 |
+ int
|
|
Karsten Hopp |
4f31f7 |
+ check_nomodeline(argp)
|
|
Karsten Hopp |
4f31f7 |
+ char_u **argp;
|
|
Karsten Hopp |
4f31f7 |
+ {
|
|
Karsten Hopp |
4f31f7 |
+ if (STRNCMP(*argp, "<nomodeline>", 12) == 0)
|
|
Karsten Hopp |
4f31f7 |
+ {
|
|
Karsten Hopp |
4f31f7 |
+ *argp = skipwhite(*argp + 12);
|
|
Karsten Hopp |
4f31f7 |
+ return FALSE;
|
|
Karsten Hopp |
4f31f7 |
+ }
|
|
Karsten Hopp |
4f31f7 |
+ return TRUE;
|
|
Karsten Hopp |
4f31f7 |
+ }
|
|
Karsten Hopp |
4f31f7 |
+
|
|
Karsten Hopp |
4f31f7 |
+ /*
|
|
Karsten Hopp |
4f31f7 |
* Prepare for executing autocommands for (hidden) buffer "buf".
|
|
Karsten Hopp |
4f31f7 |
* Search for a visible window containing the current buffer. If there isn't
|
|
Karsten Hopp |
4f31f7 |
* one then use "aucmd_win".
|
|
Karsten Hopp |
4f31f7 |
*** ../vim-7.3.441/src/ex_docmd.c 2012-01-26 20:41:22.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
--- src/ex_docmd.c 2012-02-12 20:05:18.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
***************
|
|
Karsten Hopp |
4f31f7 |
*** 4955,4961 ****
|
|
Karsten Hopp |
4f31f7 |
map_clear(eap->cmd, eap->arg, TRUE, TRUE);
|
|
Karsten Hopp |
4f31f7 |
}
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
! #ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
4f31f7 |
static void
|
|
Karsten Hopp |
4f31f7 |
ex_autocmd(eap)
|
|
Karsten Hopp |
4f31f7 |
exarg_T *eap;
|
|
Karsten Hopp |
4f31f7 |
--- 4955,4961 ----
|
|
Karsten Hopp |
4f31f7 |
map_clear(eap->cmd, eap->arg, TRUE, TRUE);
|
|
Karsten Hopp |
4f31f7 |
}
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
! #if defined(FEAT_AUTOCMD) || defined(PROTO)
|
|
Karsten Hopp |
4f31f7 |
static void
|
|
Karsten Hopp |
4f31f7 |
ex_autocmd(eap)
|
|
Karsten Hopp |
4f31f7 |
exarg_T *eap;
|
|
Karsten Hopp |
4f31f7 |
***************
|
|
Karsten Hopp |
4f31f7 |
*** 4982,4989 ****
|
|
Karsten Hopp |
4f31f7 |
ex_doautocmd(eap)
|
|
Karsten Hopp |
4f31f7 |
exarg_T *eap;
|
|
Karsten Hopp |
4f31f7 |
{
|
|
Karsten Hopp |
4f31f7 |
! (void)do_doautocmd(eap->arg, TRUE);
|
|
Karsten Hopp |
4f31f7 |
! do_modelines(0);
|
|
Karsten Hopp |
4f31f7 |
}
|
|
Karsten Hopp |
4f31f7 |
#endif
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
--- 4982,4993 ----
|
|
Karsten Hopp |
4f31f7 |
ex_doautocmd(eap)
|
|
Karsten Hopp |
4f31f7 |
exarg_T *eap;
|
|
Karsten Hopp |
4f31f7 |
{
|
|
Karsten Hopp |
4f31f7 |
! char_u *arg = eap->arg;
|
|
Karsten Hopp |
4f31f7 |
! int call_do_modelines = check_nomodeline(&arg;;
|
|
Karsten Hopp |
4f31f7 |
!
|
|
Karsten Hopp |
4f31f7 |
! (void)do_doautocmd(arg, TRUE);
|
|
Karsten Hopp |
4f31f7 |
! if (call_do_modelines) /* Only when there is no <nomodeline>. */
|
|
Karsten Hopp |
4f31f7 |
! do_modelines(0);
|
|
Karsten Hopp |
4f31f7 |
}
|
|
Karsten Hopp |
4f31f7 |
#endif
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
*** ../vim-7.3.441/src/proto/fileio.pro 2010-12-17 16:27:10.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
--- src/proto/fileio.pro 2012-02-12 20:05:26.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
***************
|
|
Karsten Hopp |
4f31f7 |
*** 35,40 ****
|
|
Karsten Hopp |
4f31f7 |
--- 35,41 ----
|
|
Karsten Hopp |
4f31f7 |
void do_autocmd __ARGS((char_u *arg, int forceit));
|
|
Karsten Hopp |
4f31f7 |
int do_doautocmd __ARGS((char_u *arg, int do_msg));
|
|
Karsten Hopp |
4f31f7 |
void ex_doautoall __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
4f31f7 |
+ int check_nomodeline __ARGS((char_u **argp));
|
|
Karsten Hopp |
4f31f7 |
void aucmd_prepbuf __ARGS((aco_save_T *aco, buf_T *buf));
|
|
Karsten Hopp |
4f31f7 |
void aucmd_restbuf __ARGS((aco_save_T *aco));
|
|
Karsten Hopp |
4f31f7 |
int apply_autocmds __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf));
|
|
Karsten Hopp |
4f31f7 |
*** ../vim-7.3.441/runtime/doc/autocmd.txt 2012-02-12 00:18:54.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
--- runtime/doc/autocmd.txt 2012-02-12 20:11:05.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
***************
|
|
Karsten Hopp |
4f31f7 |
*** 1064,1069 ****
|
|
Karsten Hopp |
4f31f7 |
--- 1072,1085 ----
|
|
Karsten Hopp |
4f31f7 |
argument is included, Vim executes only the matching
|
|
Karsten Hopp |
4f31f7 |
autocommands for that group. Note: if you use an
|
|
Karsten Hopp |
4f31f7 |
undefined group name, Vim gives you an error message.
|
|
Karsten Hopp |
4f31f7 |
+ *<nomodeline>*
|
|
Karsten Hopp |
4f31f7 |
+ After applying the autocommands the modelines are
|
|
Karsten Hopp |
4f31f7 |
+ processed, so that their settings overrule the
|
|
Karsten Hopp |
4f31f7 |
+ settings from autocommands, like what happens when
|
|
Karsten Hopp |
4f31f7 |
+ editing a file. This is skipped when the <nomodeline>
|
|
Karsten Hopp |
4f31f7 |
+ argument is present. You probably want to use
|
|
Karsten Hopp |
4f31f7 |
+ <nomodeline> for events that are not used when loading
|
|
Karsten Hopp |
4f31f7 |
+ a buffer, such as |User|.
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
*:doautoa* *:doautoall*
|
|
Karsten Hopp |
4f31f7 |
:doautoa[ll] [<nomodeline>] [group] {event} [fname]
|
|
Karsten Hopp |
4f31f7 |
***************
|
|
Karsten Hopp |
4f31f7 |
*** 1077,1088 ****
|
|
Karsten Hopp |
4f31f7 |
This command is intended for autocommands that set
|
|
Karsten Hopp |
4f31f7 |
options, change highlighting, and things like that.
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
- After applying the autocommands the modelines are
|
|
Karsten Hopp |
4f31f7 |
- processed, so that their settings overrule the
|
|
Karsten Hopp |
4f31f7 |
- settings from autocommands, like what happens when
|
|
Karsten Hopp |
4f31f7 |
- editing a file. This is skipped when the <nomodeline>
|
|
Karsten Hopp |
4f31f7 |
- argument is present.
|
|
Karsten Hopp |
4f31f7 |
-
|
|
Karsten Hopp |
4f31f7 |
==============================================================================
|
|
Karsten Hopp |
4f31f7 |
10. Using autocommands *autocmd-use*
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
--- 1093,1098 ----
|
|
Karsten Hopp |
4f31f7 |
*** ../vim-7.3.441/src/version.c 2012-02-12 01:55:50.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
--- src/version.c 2012-02-12 20:11:34.000000000 +0100
|
|
Karsten Hopp |
4f31f7 |
***************
|
|
Karsten Hopp |
4f31f7 |
*** 716,717 ****
|
|
Karsten Hopp |
4f31f7 |
--- 716,719 ----
|
|
Karsten Hopp |
4f31f7 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
4f31f7 |
+ /**/
|
|
Karsten Hopp |
4f31f7 |
+ 442,
|
|
Karsten Hopp |
4f31f7 |
/**/
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
--
|
|
Karsten Hopp |
4f31f7 |
The real
|
|
Karsten Hopp |
4f31f7 |
trick is
|
|
Karsten Hopp |
4f31f7 |
this: to
|
|
Karsten Hopp |
4f31f7 |
keep the
|
|
Karsten Hopp |
4f31f7 |
lines as
|
|
Karsten Hopp |
4f31f7 |
short as
|
|
Karsten Hopp |
4f31f7 |
possible
|
|
Karsten Hopp |
4f31f7 |
and keep
|
|
Karsten Hopp |
4f31f7 |
the size
|
|
Karsten Hopp |
4f31f7 |
the same
|
|
Karsten Hopp |
4f31f7 |
yet free
|
|
Karsten Hopp |
4f31f7 |
from the
|
|
Karsten Hopp |
4f31f7 |
need for
|
|
Karsten Hopp |
4f31f7 |
hyphena-
|
|
Karsten Hopp |
4f31f7 |
Dammit!! (Matthew Winn)
|
|
Karsten Hopp |
4f31f7 |
|
|
Karsten Hopp |
4f31f7 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
4f31f7 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
4f31f7 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
4f31f7 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|