summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1366
blob: 1fac2704f239640f5f1f5e910429608751b06587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1366
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1366
Problem:    Using expressions in a modeline is unsafe.
Solution:   Disallow using expressions in a modeline, unless the
            'modelineexpr' option is set.  Update help, add more tests.
Files:	    runtime/doc/options.txt, src/option.c, src/option.h,
            src/testdir/test_modeline.vim, src/testdir/test49.in


*** ../vim-8.1.1365/runtime/doc/options.txt	2019-05-05 18:11:46.320590639 +0200
--- runtime/doc/options.txt	2019-05-23 15:14:40.692739911 +0200
***************
*** 578,591 ****
     /* vi:set dir=c\:\tmp: */ ~
  This sets the 'dir' option to "c:\tmp".  Only a single backslash before the
  ':' is removed.  Thus to include "\:" you have to specify "\\:".
! 
  No other commands than "set" are supported, for security reasons (somebody
  might create a Trojan horse text file with modelines).  And not all options
! can be set.  For some options a flag is set, so that when it's used the
! |sandbox| is effective.  Still, there is always a small risk that a modeline
! causes trouble.  E.g., when some joker sets 'textwidth' to 5 all your lines
! are wrapped unexpectedly.  So disable modelines before editing untrusted text.
! The mail ftplugin does this, for example.
  
  Hint: If you would like to do something else than setting an option, you could
  define an autocommand that checks the file for a specific string.  For
--- 578,594 ----
     /* vi:set dir=c\:\tmp: */ ~
  This sets the 'dir' option to "c:\tmp".  Only a single backslash before the
  ':' is removed.  Thus to include "\:" you have to specify "\\:".
! 							*E992*
  No other commands than "set" are supported, for security reasons (somebody
  might create a Trojan horse text file with modelines).  And not all options
! can be set.  For some options a flag is set, so that when the value is used
! the |sandbox| is effective.  Some options can only be set from the modeline
! when 'modelineexpr' is set (the default is off).
! 
! Still, there is always a small risk that a modeline causes trouble.  E.g.,
! when some joker sets 'textwidth' to 5 all your lines are wrapped unexpectedly.
! So disable modelines before editing untrusted text.  The mail ftplugin does
! this, for example.
  
  Hint: If you would like to do something else than setting an option, you could
  define an autocommand that checks the file for a specific string.  For
***************
*** 795,803 ****
  	a different way.
  	The 'autoindent' option is reset when the 'paste' option is set and
  	restored when 'paste' is reset.
- 	{small difference from Vi: After the indent is deleted when typing
- 	<Esc> or <CR>, the cursor position when moving up or down is after the
- 	deleted indent; Vi puts the cursor somewhere in the deleted indent}.
  
  				 *'autoread'* *'ar'* *'noautoread'* *'noar'*
  'autoread' 'ar'		boolean	(default off)
--- 798,803 ----
***************
*** 1121,1127 ****
  			{only available when compiled with the |+balloon_eval|
  			feature}
  	Expression for text to show in evaluation balloon.  It is only used
! 	when 'ballooneval' is on.  These variables can be used:
  
  	v:beval_bufnr	number of the buffer in which balloon is going to show
  	v:beval_winnr	number of the window
--- 1121,1128 ----
  			{only available when compiled with the |+balloon_eval|
  			feature}
  	Expression for text to show in evaluation balloon.  It is only used
! 	when 'ballooneval' or 'balloonevalterm' is on.  These variables can be
! 	used:
  
  	v:beval_bufnr	number of the buffer in which balloon is going to show
  	v:beval_winnr	number of the window
***************
*** 1132,1138 ****
  
  	The evaluation of the expression must not have side effects!
  	Example: >
!     function! MyBalloonExpr()
  	return 'Cursor is at line ' . v:beval_lnum .
  		\', column ' . v:beval_col .
  		\ ' of file ' .  bufname(v:beval_bufnr) .
--- 1133,1139 ----
  
  	The evaluation of the expression must not have side effects!
  	Example: >
!     function MyBalloonExpr()
  	return 'Cursor is at line ' . v:beval_lnum .
  		\', column ' . v:beval_col .
  		\ ' of file ' .  bufname(v:beval_bufnr) .
***************
*** 1151,1156 ****
--- 1152,1158 ----
  
  	The expression will be evaluated in the |sandbox| when set from a
  	modeline, see |sandbox-option|.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  
  	It is not allowed to change text or jump to another window while
  	evaluating 'balloonexpr' |textlock|.
***************
*** 2677,2683 ****
  	uses another default.
  	This option cannot be set from a |modeline| or in the |sandbox|, for
  	security reasons.
- 	{Vi: directory to put temp file in, defaults to "/tmp"}
  
  					*'display'* *'dy'*
  'display' 'dy'		string	(default "", set to "truncate" in
--- 2679,2684 ----
***************
*** 3229,3235 ****
  	The expression will be evaluated in the |sandbox| if set from a
  	modeline, see |sandbox-option|.
  	This option can't be set from a |modeline| when the 'diff' option is
! 	on.
  
  	It is not allowed to change text or jump to another window while
  	evaluating 'foldexpr' |textlock|.
--- 3230,3236 ----
  	The expression will be evaluated in the |sandbox| if set from a
  	modeline, see |sandbox-option|.
  	This option can't be set from a |modeline| when the 'diff' option is
! 	on or the 'modelineexpr' option is off.
  
  	It is not allowed to change text or jump to another window while
  	evaluating 'foldexpr' |textlock|.
***************
*** 3362,3367 ****
--- 3363,3369 ----
  
  	The expression will be evaluated in the |sandbox| if set from a
  	modeline, see |sandbox-option|.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  
  	It is not allowed to change text or jump to another window while
  	evaluating 'foldtext' |textlock|.
***************
*** 3399,3404 ****
--- 3401,3407 ----
  	The expression will be evaluated in the |sandbox| when set from a
  	modeline, see |sandbox-option|.  That stops the option from working,
  	since changing the buffer text is not allowed.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  	NOTE: This option is set to "" when 'compatible' is set.
  
  					*'formatlistpat'* *'flp'*
***************
*** 3455,3460 ****
--- 3458,3465 ----
  	Also see 'swapsync' for controlling fsync() on swap files.
  	'fsync' also applies to |writefile()|, unless a flag is used to
  	overrule it.
+ 	This option cannot be set from a |modeline| or in the |sandbox|, for
+ 	security reasons.
  
  				   *'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
  'gdefault' 'gd'		boolean	(default off)
***************
*** 3622,3628 ****
  						*'guiheadroom'* *'ghr'*
  'guiheadroom' 'ghr'	number	(default 50)
  			global
! - 			{only for GTK and X11 GUI}
  	The number of pixels subtracted from the screen height when fitting
  	the GUI window on the screen.  Set this before the GUI is started,
  	e.g., in your |gvimrc| file.  When zero, the whole screen height will
--- 3627,3633 ----
  						*'guiheadroom'* *'ghr'*
  'guiheadroom' 'ghr'	number	(default 50)
  			global
! 			{only for GTK and X11 GUI}
  	The number of pixels subtracted from the screen height when fitting
  	the GUI window on the screen.  Set this before the GUI is started,
  	e.g., in your |gvimrc| file.  When zero, the whole screen height will
***************
*** 3780,3785 ****
--- 3785,3791 ----
  	'guitabtooltip' is used for the tooltip, see below.
  	The expression will be evaluated in the |sandbox| when set from a
  	modeline, see |sandbox-option|.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  
  	Only used when the GUI tab pages line is displayed.  'e' must be
  	present in 'guioptions'.  For the non-GUI tab pages line 'tabline' is
***************
*** 4030,4035 ****
--- 4036,4042 ----
  	When this option contains printf-style '%' items, they will be
  	expanded according to the rules used for 'statusline'.  See
  	'titlestring' for example settings.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  	{not available when compiled without the |+statusline| feature}
  
  			*'ignorecase'* *'ic'* *'noignorecase'* *'noic'*
***************
*** 4047,4052 ****
--- 4054,4061 ----
  	This option specifies a function that will be called to
  	activate or deactivate the Input Method.
  	It is not used in the GUI.
+ 	The expression will be evaluated in the |sandbox| when set from a
+ 	modeline, see |sandbox-option|.
  
  	Example: >
  		function ImActivateFunc(active)
***************
*** 4163,4168 ****
--- 4172,4179 ----
  		set imstatusfunc=ImStatusFunc
  <
  	NOTE: This function is invoked very often.  Keep it fast.
+ 	The expression will be evaluated in the |sandbox| when set from a
+ 	modeline, see |sandbox-option|.
  
  						*'imstyle'* *'imst'*
  'imstyle' 'imst'	number (default 1)
***************
*** 4179,4184 ****
--- 4190,4197 ----
  	|single-repeat|, etc.  Therefore over-the-spot style becomes the
  	default now.  This should work fine for most people, however if you
  	have any problem with it, try using on-the-spot style.
+ 	The expression will be evaluated in the |sandbox| when set from a
+ 	modeline, see |sandbox-option|.
  
  						*'include'* *'inc'*
  'include' 'inc'		string	(default "^\s*#\s*include")
***************
*** 4213,4218 ****
--- 4226,4232 ----
  
  	The expression will be evaluated in the |sandbox| when set from a
  	modeline, see |sandbox-option|.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  
  	It is not allowed to change text or jump to another window while
  	evaluating 'includeexpr' |textlock|.
***************
*** 4300,4305 ****
--- 4314,4320 ----
  
  	The expression will be evaluated in the |sandbox| when set from a
  	modeline, see |sandbox-option|.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  
  	It is not allowed to change text or jump to another window while
  	evaluating 'indentexpr' |textlock|.
***************
*** 4707,4713 ****
  	"=" operator to use this same indentation algorithm rather than
  	calling an external program if 'equalprg' is empty.
  	This option is not used when 'paste' is set.
- 	{Vi: Does it a little bit differently}
  
  						*'lispwords'* *'lw'*
  'lispwords' 'lw'	string	(default is very long)
--- 4722,4727 ----
***************
*** 4897,4902 ****
--- 4911,4922 ----
  <	This option cannot be set from a |modeline| or in the |sandbox|, for
  	security reasons.
  
+ 						*'makespellmem'* *'msm'*
+ 'makespellmem' 'msm'		string	(default "460000,2000,500")
+ 			global
+ 	Values relevant only when compressing a spell file, see |spell|.
+ 	This option cannot be set from a |modeline| or in the |sandbox|.
+ 
  						*'matchpairs'* *'mps'*
  'matchpairs' 'mps'	string	(default "(:),{:},[:]")
  			local to buffer
***************
*** 4919,4925 ****
  						*'matchtime'* *'mat'*
  'matchtime' 'mat'	number	(default 5)
  			global
- 			{in Nvi}
  	Tenths of a second to show the matching paren, when 'showmatch' is
  	set.  Note that this is not in milliseconds, like other options that
  	set a time.  This is to be compatible with Nvi.
--- 4939,4944 ----
***************
*** 5053,5058 ****
--- 5072,5088 ----
  'modeline' 'ml'		boolean	(Vim default: on (off for root),
  				 Vi default: off)
  			local to buffer
+ 	If 'modeline' is on 'modelines' gives the number of lines that is
+ 	checked for set commands.  If 'modeline' is off or 'modelines' is zero
+ 	no lines are checked.  See |modeline|.
+ 
+ 			   *'modelineexpr'* *'mle'* *'nomodelineexpr'* *'nomle'*
+ 'modelineexpr' 'mle'	boolean (default: off)
+ 			global
+ 	When on allow some options that are an expression to be set in the
+ 	modeline.  Check the option for whether it is affected by
+ 	'modelineexpr'.  Also see |modeline|.
+ 
  						*'modelines'* *'mls'*
  'modelines' 'mls'	number	(default 5)
  			global
***************
*** 5063,5071 ****
  	set and to the Vim default value when 'compatible' is reset.
  
  				*'modifiable'* *'ma'* *'nomodifiable'* *'noma'*
  'modifiable' 'ma'	boolean	(default on)
  			local to buffer
- 			*E21*
  	When off the buffer contents cannot be changed.  The 'fileformat' and
  	'fileencoding' options also can't be changed.
  	Can be reset on startup with the |-M| command line argument.
--- 5093,5101 ----
  	set and to the Vim default value when 'compatible' is reset.
  
  				*'modifiable'* *'ma'* *'nomodifiable'* *'noma'*
+ 				*E21*
  'modifiable' 'ma'	boolean	(default on)
  			local to buffer
  	When off the buffer contents cannot be changed.  The 'fileformat' and
  	'fileencoding' options also can't be changed.
  	Can be reset on startup with the |-M| command line argument.
***************
*** 6062,6067 ****
--- 6092,6099 ----
  	When this option is not empty, it determines the content of the ruler
  	string, as displayed for the 'ruler' option.
  	The format of this option is like that of 'statusline'.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
+ 
  	The default ruler width is 17 characters.  To make the ruler 15
  	characters wide, put "%15(" at the start and "%)" at the end.
  	Example: >
***************
*** 6585,6591 ****
  	  O	message for reading a file overwrites any previous message.
  		Also for quickfix message (e.g., ":cn").
  	  s	don't give "search hit BOTTOM, continuing at TOP" or "search
! 		hit TOP, continuing at BOTTOM" messages
  	  t	truncate file message at the start if it is too long to fit
  		on the command-line, "<" will appear in the left most column.
  		Ignored in Ex mode.
--- 6617,6624 ----
  	  O	message for reading a file overwrites any previous message.
  		Also for quickfix message (e.g., ":cn").
  	  s	don't give "search hit BOTTOM, continuing at TOP" or "search
! 		hit TOP, continuing at BOTTOM" messages; when using the search
! 		count do not show "W" after the count message (see S below)
  	  t	truncate file message at the start if it is too long to fit
  		on the command-line, "<" will appear in the left most column.
  		Ignored in Ex mode.
***************
*** 6601,6607 ****
  		"Pattern not found", "Back at original", etc.
  	  q	use "recording" instead of "recording @a"
  	  F	don't give the file info when editing a file, like `:silent`
! 		was used for the command
  	  S     do not show search count message when searching, e.g.
  	        "[1/5]"
  
--- 6634,6641 ----
  		"Pattern not found", "Back at original", etc.
  	  q	use "recording" instead of "recording @a"
  	  F	don't give the file info when editing a file, like `:silent`
! 		was used for the command; note that this also affects messages
! 		from autocommands
  	  S     do not show search count message when searching, e.g.
  	        "[1/5]"
  
***************
*** 7168,7173 ****
--- 7202,7208 ----
  
  	The 'statusline' option will be evaluated in the |sandbox| if set from
  	a modeline, see |sandbox-option|.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  
  	It is not allowed to change text or jump to another window while
  	evaluating 'statusline' |textlock|.
***************
*** 7348,7353 ****
--- 7383,7389 ----
  
  	When changing something that is used in 'tabline' that does not
  	trigger it to be updated, use |:redrawtabline|.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
  
  	Keep in mind that only one of the tab pages is the current one, others
  	are invisible and you can't jump to their windows.
***************
*** 7443,7449 ****
  	must be included in the tags file.
  	This option doesn't affect commands that find all matching tags (e.g.,
  	command-line completion and ":help").
- 	{Vi: always uses binary search in some versions}
  
  							*'tagcase'* *'tc'*
  'tagcase' 'tc'		string	(default "followic")
--- 7479,7484 ----
***************
*** 7507,7513 ****
  	The use of |:set+=| and |:set-=| is preferred when adding or removing
  	file names from the list.  This avoids problems when a future version
  	uses another default.
- 	{Vi: default is "tags /usr/lib/tags"}
  
  				*'tagstack'* *'tgst'* *'notagstack'* *'notgst'*
  'tagstack' 'tgst'	boolean	(default on)
--- 7542,7547 ----
***************
*** 7878,7885 ****
--- 7912,7922 ----
  	non-empty 't_ts' option).
  	When Vim was compiled with HAVE_X11 defined, the original title will
  	be restored if possible, see |X11|.
+ 
  	When this option contains printf-style '%' items, they will be
  	expanded according to the rules used for 'statusline'.
+ 	This option cannot be set in a modeline when 'modelineexpr' is off.
+ 
  	Example: >
      :auto BufEnter * let &titlestring = hostname() . "/" . expand("%:p")
      :set title titlestring=%<%F%=%l/%L-%P titlelen=70
***************
*** 8065,8070 ****
--- 8102,8109 ----
  	undo file that exists is used.  When it cannot be read an error is
  	given, no further entry is used.
  	See |undo-persistence|.
+ 	This option cannot be set from a |modeline| or in the |sandbox|, for
+ 	security reasons.
  
  				*'undofile'* *'noundofile'* *'udf'* *'noudf'*
  'undofile' 'udf'	boolean	(default off)
***************
*** 8374,8379 ****
--- 8413,8420 ----
  	When equal to "NONE" no viminfo file will be read or written.
  	This option can be set with the |-i| command line flag.  The |--clean|
  	command line flag sets it to "NONE".
+ 	This option cannot be set from a |modeline| or in the |sandbox|, for
+ 	security reasons.
  
  					    *'virtualedit'* *'ve'*
  'virtualedit' 've'	string	(default "")
***************
*** 8783,8790 ****
  	When 'textwidth' is non-zero, this option is not used.
  	This option is set to 0 when 'paste' is set and restored when 'paste'
  	is reset.
! 	See also 'formatoptions' and |ins-textwidth|.  {Vi: works differently
! 	and less usefully}
  
  				   *'wrapscan'* *'ws'* *'nowrapscan'* *'nows'*
  'wrapscan' 'ws'		boolean	(default on)			*E384* *E385*
--- 8824,8830 ----
  	When 'textwidth' is non-zero, this option is not used.
  	This option is set to 0 when 'paste' is set and restored when 'paste'
  	is reset.
! 	See also 'formatoptions' and |ins-textwidth|.
  
  				   *'wrapscan'* *'ws'* *'nowrapscan'* *'nows'*
  'wrapscan' 'ws'		boolean	(default on)			*E384* *E385*
*** ../vim-8.1.1365/src/option.c	2019-05-19 19:59:30.164255569 +0200
--- src/option.c	2019-05-23 14:35:57.497475468 +0200
***************
*** 467,472 ****
--- 467,473 ----
  				  * there is a redraw flag */
  #define P_NDNAME      0x8000000L /* only normal dir name chars allowed */
  #define P_RWINONLY   0x10000000L /* only redraw current window */
+ #define P_MLE	     0x20000000L /* under control of 'modelineexpr' */
  
  #define ISK_LATIN1  (char_u *)"@,48-57,_,192-255"
  
***************
*** 650,656 ****
  			    {(char_u *)0L, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
  #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
  			    (char_u *)&p_bexpr, PV_BEXPR,
  			    {(char_u *)"", (char_u *)0L}
--- 651,657 ----
  			    {(char_u *)0L, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM|P_MLE,
  #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
  			    (char_u *)&p_bexpr, PV_BEXPR,
  			    {(char_u *)"", (char_u *)0L}
***************
*** 727,733 ****
  			    (char_u *)&p_cmp, PV_NONE,
  			    {(char_u *)"internal,keepascii", (char_u *)0L}
  			    SCTX_INIT},
!     {"cdpath",	    "cd",   P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
  #ifdef FEAT_SEARCHPATH
  			    (char_u *)&p_cdpath, PV_NONE,
  			    {(char_u *)",,", (char_u *)0L}
--- 728,734 ----
  			    (char_u *)&p_cmp, PV_NONE,
  			    {(char_u *)"internal,keepascii", (char_u *)0L}
  			    SCTX_INIT},
!     {"cdpath",	    "cd",   P_STRING|P_EXPAND|P_VI_DEF|P_SECURE|P_COMMA|P_NODUP,
  #ifdef FEAT_SEARCHPATH
  			    (char_u *)&p_cdpath, PV_NONE,
  			    {(char_u *)",,", (char_u *)0L}
***************
*** 1175,1181 ****
  			    {(char_u *)NULL, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"foldexpr",    "fde",  P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
  #if defined(FEAT_FOLDING) && defined(FEAT_EVAL)
  			    (char_u *)VAR_WIN, PV_FDE,
  			    {(char_u *)"0", (char_u *)NULL}
--- 1176,1182 ----
  			    {(char_u *)NULL, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"foldexpr",    "fde",  P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN|P_MLE,
  #if defined(FEAT_FOLDING) && defined(FEAT_EVAL)
  			    (char_u *)VAR_WIN, PV_FDE,
  			    {(char_u *)"0", (char_u *)NULL}
***************
*** 1258,1264 ****
  			    {(char_u *)NULL, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"foldtext",    "fdt",  P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
  #if defined(FEAT_FOLDING) && defined(FEAT_EVAL)
  			    (char_u *)VAR_WIN, PV_FDT,
  			    {(char_u *)"foldtext()", (char_u *)NULL}
--- 1259,1265 ----
  			    {(char_u *)NULL, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"foldtext",    "fdt",  P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN|P_MLE,
  #if defined(FEAT_FOLDING) && defined(FEAT_EVAL)
  			    (char_u *)VAR_WIN, PV_FDT,
  			    {(char_u *)"foldtext()", (char_u *)NULL}
***************
*** 1267,1273 ****
  			    {(char_u *)NULL, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"formatexpr", "fex",   P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
  #ifdef FEAT_EVAL
  			    (char_u *)&p_fex, PV_FEX,
  			    {(char_u *)"", (char_u *)0L}
--- 1268,1274 ----
  			    {(char_u *)NULL, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"formatexpr", "fex",   P_STRING|P_ALLOCED|P_VI_DEF|P_VIM|P_MLE,
  #ifdef FEAT_EVAL
  			    (char_u *)&p_fex, PV_FEX,
  			    {(char_u *)"", (char_u *)0L}
***************
*** 1406,1412 ****
  			    (char_u *)NULL, PV_NONE,
  #endif
  			    {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
!     {"guitablabel",  "gtl", P_STRING|P_VI_DEF|P_RWIN,
  #if defined(FEAT_GUI_TABLINE)
  			    (char_u *)&p_gtl, PV_NONE,
  			    {(char_u *)"", (char_u *)0L}
--- 1407,1413 ----
  			    (char_u *)NULL, PV_NONE,
  #endif
  			    {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
!     {"guitablabel",  "gtl", P_STRING|P_VI_DEF|P_RWIN|P_MLE,
  #if defined(FEAT_GUI_TABLINE)
  			    (char_u *)&p_gtl, PV_NONE,
  			    {(char_u *)"", (char_u *)0L}
***************
*** 1477,1483 ****
  			    (char_u *)NULL, PV_NONE,
  #endif
  			    {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
!     {"iconstring",  NULL,   P_STRING|P_VI_DEF,
  #ifdef FEAT_TITLE
  			    (char_u *)&p_iconstring, PV_NONE,
  #else
--- 1478,1484 ----
  			    (char_u *)NULL, PV_NONE,
  #endif
  			    {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
!     {"iconstring",  NULL,   P_STRING|P_VI_DEF|P_MLE,
  #ifdef FEAT_TITLE
  			    (char_u *)&p_iconstring, PV_NONE,
  #else
***************
*** 1549,1555 ****
  			    {(char_u *)0L, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"includeexpr", "inex", P_STRING|P_ALLOCED|P_VI_DEF,
  #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
  			    (char_u *)&p_inex, PV_INEX,
  			    {(char_u *)"", (char_u *)0L}
--- 1550,1556 ----
  			    {(char_u *)0L, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"includeexpr", "inex", P_STRING|P_ALLOCED|P_VI_DEF|P_MLE,
  #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
  			    (char_u *)&p_inex, PV_INEX,
  			    {(char_u *)"", (char_u *)0L}
***************
*** 1561,1567 ****
      {"incsearch",   "is",   P_BOOL|P_VI_DEF|P_VIM,
  			    (char_u *)&p_is, PV_NONE,
  			    {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
!     {"indentexpr", "inde",  P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
  #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
  			    (char_u *)&p_inde, PV_INDE,
  			    {(char_u *)"", (char_u *)0L}
--- 1562,1568 ----
      {"incsearch",   "is",   P_BOOL|P_VI_DEF|P_VIM,
  			    (char_u *)&p_is, PV_NONE,
  			    {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
!     {"indentexpr", "inde",  P_STRING|P_ALLOCED|P_VI_DEF|P_VIM|P_MLE,
  #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
  			    (char_u *)&p_inde, PV_INDE,
  			    {(char_u *)"", (char_u *)0L}
***************
*** 1888,1893 ****
--- 1889,1897 ----
      {"modeline",    "ml",   P_BOOL|P_VIM,
  			    (char_u *)&p_ml, PV_ML,
  			    {(char_u *)FALSE, (char_u *)TRUE} SCTX_INIT},
+     {"modelineexpr", "mle",  P_BOOL|P_VI_DEF,
+ 			    (char_u *)&p_mle, PV_NONE,
+ 			    {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
      {"modelines",   "mls",  P_NUM|P_VI_DEF,
  			    (char_u *)&p_mls, PV_NONE,
  			    {(char_u *)5L, (char_u *)0L} SCTX_INIT},
***************
*** 2311,2317 ****
  			    (char_u *)NULL, PV_NONE,
  #endif
  			    {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
!     {"rulerformat", "ruf",  P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
  #ifdef FEAT_STL_OPT
  			    (char_u *)&p_ruf, PV_NONE,
  #else
--- 2315,2321 ----
  			    (char_u *)NULL, PV_NONE,
  #endif
  			    {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
!     {"rulerformat", "ruf",  P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT|P_MLE,
  #ifdef FEAT_STL_OPT
  			    (char_u *)&p_ruf, PV_NONE,
  #else
***************
*** 2577,2583 ****
      {"startofline", "sol",  P_BOOL|P_VI_DEF|P_VIM,
  			    (char_u *)&p_sol, PV_NONE,
  			    {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
!     {"statusline"  ,"stl",  P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
  #ifdef FEAT_STL_OPT
  			    (char_u *)&p_stl, PV_STL,
  #else
--- 2581,2587 ----
      {"startofline", "sol",  P_BOOL|P_VI_DEF|P_VIM,
  			    (char_u *)&p_sol, PV_NONE,
  			    {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
!     {"statusline"  ,"stl",  P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT|P_MLE,
  #ifdef FEAT_STL_OPT
  			    (char_u *)&p_stl, PV_STL,
  #else
***************
*** 2624,2630 ****
  			    {(char_u *)0L, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"tabline",	    "tal",  P_STRING|P_VI_DEF|P_RALL,
  #ifdef FEAT_STL_OPT
  			    (char_u *)&p_tal, PV_NONE,
  #else
--- 2628,2634 ----
  			    {(char_u *)0L, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"tabline",	    "tal",  P_STRING|P_VI_DEF|P_RALL|P_MLE,
  #ifdef FEAT_STL_OPT
  			    (char_u *)&p_tal, PV_NONE,
  #else
***************
*** 2802,2808 ****
  			    {(char_u *)0L, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"titlestring", NULL,   P_STRING|P_VI_DEF,
  #ifdef FEAT_TITLE
  			    (char_u *)&p_titlestring, PV_NONE,
  #else
--- 2806,2812 ----
  			    {(char_u *)0L, (char_u *)0L}
  #endif
  			    SCTX_INIT},
!     {"titlestring", NULL,   P_STRING|P_VI_DEF|P_MLE,
  #ifdef FEAT_TITLE
  			    (char_u *)&p_titlestring, PV_NONE,
  #else
***************
*** 4549,4554 ****
--- 4553,4563 ----
  		    errmsg = _("E520: Not allowed in a modeline");
  		    goto skip;
  		}
+ 		if ((flags & P_MLE) && !p_mle)
+ 		{
+ 		    errmsg = _("E992: Not allowed in a modeline when 'modelineexpr' is off");
+ 		    goto skip;
+ 		}
  #ifdef FEAT_DIFF
  		/* In diff mode some options are overruled.  This avoids that
  		 * 'foldmethod' becomes "marker" instead of "diff" and that
*** ../vim-8.1.1365/src/option.h	2019-05-04 21:08:17.119814244 +0200
--- src/option.h	2019-05-23 13:24:39.458971246 +0200
***************
*** 631,636 ****
--- 631,637 ----
  #ifdef FEAT_SPELL
  EXTERN char_u	*p_msm;		/* 'mkspellmem' */
  #endif
+ EXTERN long	p_mle;		/* 'modelineexpr' */
  EXTERN long	p_mls;		/* 'modelines' */
  EXTERN char_u	*p_mouse;	/* 'mouse' */
  #ifdef FEAT_GUI
*** ../vim-8.1.1365/src/testdir/test_modeline.vim	2018-11-25 05:06:34.943951024 +0100
--- src/testdir/test_modeline.vim	2019-05-23 15:19:35.239334528 +0200
***************
*** 60,73 ****
    set keymap= iminsert=0 imsearch=-1
  endfunc
  
! func s:modeline_fails(what, text)
    let fname = "Xmodeline_fails_" . a:what
    call writefile(['vim: set ' . a:text . ' :', 'nothing'], fname)
    let modeline = &modeline
    set modeline
    filetype plugin on
    syntax enable
!   call assert_fails('split ' . fname, 'E474:')
    call assert_equal("", &filetype)
    call assert_equal("", &syntax)
  
--- 60,76 ----
    set keymap= iminsert=0 imsearch=-1
  endfunc
  
! func s:modeline_fails(what, text, error)
!   if !exists('+' .. a:what)
!     return
!   endif
    let fname = "Xmodeline_fails_" . a:what
    call writefile(['vim: set ' . a:text . ' :', 'nothing'], fname)
    let modeline = &modeline
    set modeline
    filetype plugin on
    syntax enable
!   call assert_fails('split ' . fname, a:error)
    call assert_equal("", &filetype)
    call assert_equal("", &syntax)
  
***************
*** 79,94 ****
  endfunc
  
  func Test_modeline_filetype_fails()
!   call s:modeline_fails('filetype', 'ft=evil$CMD')
  endfunc
  
  func Test_modeline_syntax_fails()
!   call s:modeline_fails('syntax', 'syn=evil$CMD')
  endfunc
  
  func Test_modeline_keymap_fails()
!   if !has('keymap')
!     return
!   endif
!   call s:modeline_fails('keymap', 'keymap=evil$CMD')
  endfunc
--- 82,171 ----
  endfunc
  
  func Test_modeline_filetype_fails()
!   call s:modeline_fails('filetype', 'ft=evil$CMD', 'E474:')
  endfunc
  
  func Test_modeline_syntax_fails()
!   call s:modeline_fails('syntax', 'syn=evil$CMD', 'E474:')
  endfunc
  
  func Test_modeline_keymap_fails()
!   call s:modeline_fails('keymap', 'keymap=evil$CMD', 'E474:')
! endfunc
! 
! func Test_modeline_fails_always()
!   call s:modeline_fails('backupdir', 'backupdir=Something()', 'E520:')
!   call s:modeline_fails('cdpath', 'cdpath=Something()', 'E520:')
!   call s:modeline_fails('charconvert', 'charconvert=Something()', 'E520:')
!   call s:modeline_fails('completefunc', 'completefunc=Something()', 'E520:')
!   call s:modeline_fails('cscopeprg', 'cscopeprg=Something()', 'E520:')
!   call s:modeline_fails('diffexpr', 'diffexpr=Something()', 'E520:')
!   call s:modeline_fails('directory', 'directory=Something()', 'E520:')
!   call s:modeline_fails('equalprg', 'equalprg=Something()', 'E520:')
!   call s:modeline_fails('errorfile', 'errorfile=Something()', 'E520:')
!   call s:modeline_fails('exrc', 'exrc=Something()', 'E520:')
!   call s:modeline_fails('formatprg', 'formatprg=Something()', 'E520:')
!   call s:modeline_fails('fsync', 'fsync=Something()', 'E520:')
!   call s:modeline_fails('grepprg', 'grepprg=Something()', 'E520:')
!   call s:modeline_fails('helpfile', 'helpfile=Something()', 'E520:')
!   call s:modeline_fails('imactivatefunc', 'imactivatefunc=Something()', 'E520:')
!   call s:modeline_fails('imstatusfunc', 'imstatusfunc=Something()', 'E520:')
!   call s:modeline_fails('imstyle', 'imstyle=Something()', 'E520:')
!   call s:modeline_fails('keywordprg', 'keywordprg=Something()', 'E520:')
!   call s:modeline_fails('langmap', 'langmap=Something()', 'E520:')
!   call s:modeline_fails('luadll', 'luadll=Something()', 'E520:')
!   call s:modeline_fails('makeef', 'makeef=Something()', 'E520:')
!   call s:modeline_fails('makeprg', 'makeprg=Something()', 'E520:')
!   call s:modeline_fails('makespellmem', 'makespellmem=Something()', 'E520:')
!   call s:modeline_fails('mzschemedll', 'mzschemedll=Something()', 'E520:')
!   call s:modeline_fails('mzschemegcdll', 'mzschemegcdll=Something()', 'E520:')
!   call s:modeline_fails('omnifunc', 'omnifunc=Something()', 'E520:')
!   call s:modeline_fails('operatorfunc', 'operatorfunc=Something()', 'E520:')
!   call s:modeline_fails('perldll', 'perldll=Something()', 'E520:')
!   call s:modeline_fails('printdevice', 'printdevice=Something()', 'E520:')
!   call s:modeline_fails('patchexpr', 'patchexpr=Something()', 'E520:')
!   call s:modeline_fails('printexpr', 'printexpr=Something()', 'E520:')
!   call s:modeline_fails('pythondll', 'pythondll=Something()', 'E520:')
!   call s:modeline_fails('pythonhome', 'pythondll=Something()', 'E520:')
!   call s:modeline_fails('pythonthreedll', 'pythonthreedll=Something()', 'E520:')
!   call s:modeline_fails('pythonthreehome', 'pythonthreehome=Something()', 'E520:')
!   call s:modeline_fails('pyxversion', 'pyxversion=Something()', 'E520:')
!   call s:modeline_fails('rubydll', 'rubydll=Something()', 'E520:')
!   call s:modeline_fails('runtimepath', 'runtimepath=Something()', 'E520:')
!   call s:modeline_fails('secure', 'secure=Something()', 'E520:')
!   call s:modeline_fails('shell', 'shell=Something()', 'E520:')
!   call s:modeline_fails('shellcmdflag', 'shellcmdflag=Something()', 'E520:')
!   call s:modeline_fails('shellpipe', 'shellpipe=Something()', 'E520:')
!   call s:modeline_fails('shellquote', 'shellquote=Something()', 'E520:')
!   call s:modeline_fails('shellredir', 'shellredir=Something()', 'E520:')
!   call s:modeline_fails('shellxquote', 'shellxquote=Something()', 'E520:')
!   call s:modeline_fails('spellfile', 'spellfile=Something()', 'E520:')
!   call s:modeline_fails('spellsuggest', 'spellsuggest=Something()', 'E520:')
!   call s:modeline_fails('tcldll', 'tcldll=Something()', 'E520:')
!   call s:modeline_fails('titleold', 'titleold=Something()', 'E520:')
!   call s:modeline_fails('viewdir', 'viewdir=Something()', 'E520:')
!   call s:modeline_fails('viminfo', 'viminfo=Something()', 'E520:')
!   call s:modeline_fails('viminfofile', 'viminfofile=Something()', 'E520:')
!   call s:modeline_fails('winptydll', 'winptydll=Something()', 'E520:')
!   call s:modeline_fails('undodir', 'undodir=Something()', 'E520:')
!   " only check a few terminal options
!   call s:modeline_fails('t_AB', 't_AB=Something()', 'E520:')
!   call s:modeline_fails('t_ce', 't_ce=Something()', 'E520:')
!   call s:modeline_fails('t_sr', 't_sr=Something()', 'E520:')
!   call s:modeline_fails('t_8b', 't_8b=Something()', 'E520:')
! endfunc
! 
! func Test_modeline_fails_modelineexpr()
!   call s:modeline_fails('balloonexpr', 'balloonexpr=Something()', 'E992:')
!   call s:modeline_fails('foldexpr', 'foldexpr=Something()', 'E992:')
!   call s:modeline_fails('foldtext', 'foldtext=Something()', 'E992:')
!   call s:modeline_fails('formatexpr', 'formatexpr=Something()', 'E992:')
!   call s:modeline_fails('guitablabel', 'guitablabel=Something()', 'E992:')
!   call s:modeline_fails('iconstring', 'iconstring=Something()', 'E992:')
!   call s:modeline_fails('includeexpr', 'includeexpr=Something()', 'E992:')
!   call s:modeline_fails('indentexpr', 'indentexpr=Something()', 'E992:')
!   call s:modeline_fails('rulerformat', 'rulerformat=Something()', 'E992:')
!   call s:modeline_fails('statusline', 'statusline=Something()', 'E992:')
!   call s:modeline_fails('tabline', 'tabline=Something()', 'E992:')
!   call s:modeline_fails('titlestring', 'titlestring=Something()', 'E992:')
  endfunc
*** ../vim-8.1.1365/src/testdir/test49.in	2016-10-12 16:31:16.000000000 +0200
--- src/testdir/test49.in	2019-05-23 15:22:31.330449346 +0200
***************
*** 5,11 ****
  
  STARTTEST
  :so small.vim
! :se nocp nomore viminfo+=nviminfo
  :lang mess C
  :so test49.vim
  :" Go back to this file and append the results from register r.
--- 5,11 ----
  
  STARTTEST
  :so small.vim
! :se nocp nomore viminfo+=nviminfo modelineexpr
  :lang mess C
  :so test49.vim
  :" Go back to this file and append the results from register r.
*** ../vim-8.1.1365/src/version.c	2019-05-22 22:38:21.660405578 +0200
--- src/version.c	2019-05-23 15:20:33.079046674 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1366,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
18. Your wife drapes a blond wig over your monitor to remind you of what she
    looks like.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///