Patch 8.2.3384
Problem:    Cannot disable modeline for an individual file.
Solution:   Recognize "nomodeline" in a modeline. (Hu Jialun, closes #8798)
Files:      runtime/doc/options.txt, src/buffer.c,
            src/testdir/test_modeline.vim


*** ../vim-8.2.3383/runtime/doc/options.txt     2021-08-03 18:33:04.647157875 
+0200
--- runtime/doc/options.txt     2021-08-28 20:41:25.928694271 +0200
***************
*** 541,546 ****
--- 548,562 ----
  version 3.0).  Using "ex:" at the start of the line will be ignored (this
  could be short for "example:").
  
+ If the modeline is disabled within a modeline, subsequent modelines will be
+ ignored.  This is to allow turning off modeline on a per-file basis.  This is
+ useful when a line looks like a modeline but isn't.  For example, it would be
+ good to start a YAML file containing strings like "vim:" with
+     # vim: nomodeline ~
+ so as to avoid modeline misdetection.  Following options on the same line
+ after modeline deactivation, if any, are still evaluated (but you would
+ normally not have any).
+ 
                                                        *modeline-local*
  The options are set like with ":setlocal": The new value only applies to the
  buffer and window that contain the file.  Although it's possible to set global
*** ../vim-8.2.3383/src/buffer.c        2021-08-03 18:33:04.647157875 +0200
--- src/buffer.c        2021-08-28 20:16:28.077388133 +0200
***************
*** 5446,5457 ****
        return;
  
      ++entered;
!     for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count && lnum <= nmlines;
                                                                       ++lnum)
        if (chk_modeline(lnum, flags) == FAIL)
            nmlines = 0;
  
!     for (lnum = curbuf->b_ml.ml_line_count; lnum > 0 && lnum > nmlines
                       && lnum > curbuf->b_ml.ml_line_count - nmlines; --lnum)
        if (chk_modeline(lnum, flags) == FAIL)
            nmlines = 0;
--- 5446,5457 ----
        return;
  
      ++entered;
!     for (lnum = 1; curbuf->b_p_ml && lnum <= curbuf->b_ml.ml_line_count && 
lnum <= nmlines;
                                                                       ++lnum)
        if (chk_modeline(lnum, flags) == FAIL)
            nmlines = 0;
  
!     for (lnum = curbuf->b_ml.ml_line_count; curbuf->b_p_ml && lnum > 0 && 
lnum > nmlines
                       && lnum > curbuf->b_ml.ml_line_count - nmlines; --lnum)
        if (chk_modeline(lnum, flags) == FAIL)
            nmlines = 0;
*** ../vim-8.2.3383/src/testdir/test_modeline.vim       2021-06-13 
21:52:42.521260063 +0200
--- src/testdir/test_modeline.vim       2021-08-28 20:16:28.077388133 +0200
***************
*** 360,363 ****
--- 360,371 ----
    bw
  endfunc
  
+ func Test_modeline_disable()
+   set modeline
+   call writefile(['vim: sw=2', 'vim: nomodeline', 'vim: sw=3'], 
'Xmodeline_disable')
+   edit Xmodeline_disable
+   call assert_equal(2, &sw)
+   call delete('Xmodeline_disable')
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3383/src/version.c       2021-08-28 15:56:03.465179875 +0200
--- src/version.c       2021-08-28 20:38:28.845335659 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3384,
  /**/

-- 
OLD WOMAN: Well, how did you become king, then?
ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite,
        held Excalibur aloft from the bosom of the water to signify by Divine
        Providence ...  that I, Arthur, was to carry Excalibur ...  That is
        why I am your king!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202108281843.17SIhGNJ3142452%40masaka.moolenaar.net.

Raspunde prin e-mail lui