summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-14 21:12:05 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-14 21:12:05 +0200
commit865242e121405fe0f2de8223662e68c1da51a55e (patch)
treeda0c70a7c585c63be7bd1a276ca8f04305906251 /src/option.c
parent23c347c66b91ba9fe1684af202fa32956352c912 (diff)
downloadvim-git-865242e121405fe0f2de8223662e68c1da51a55e.tar.gz
Disallow setting 'enc' in a modeline. (Patrick Texier)
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/option.c b/src/option.c
index 2dfb6d967..fd763afbf 100644
--- a/src/option.c
+++ b/src/option.c
@@ -451,6 +451,7 @@ struct vimoption
#define P_INSECURE 0x400000L/* option was set from a modeline */
#define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has
side effects) */
+#define P_NO_ML 0x1000000L/* not allowed in modeline */
#define ISK_LATIN1 (char_u *)"@,48-57,_,192-255"
@@ -1015,7 +1016,7 @@ static struct vimoption
{"edcompatible","ed", P_BOOL|P_VI_DEF,
(char_u *)&p_ed, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
- {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR,
+ {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR|P_NO_ML,
#ifdef FEAT_MBYTE
(char_u *)&p_enc, PV_NONE,
{(char_u *)ENC_DFLT, (char_u *)0L}
@@ -4236,7 +4237,7 @@ do_set(arg, opt_flags)
/* Disallow changing some options from modelines. */
if (opt_flags & OPT_MODELINE)
{
- if (flags & P_SECURE)
+ if (flags & (P_SECURE | P_NO_ML))
{
errmsg = (char_u *)_("E520: Not allowed in a modeline");
goto skip;