]> granicus.if.org Git - vim/commitdiff
patch 9.0.0771: cannot always tell the difference beween tex and rexx files v9.0.0771
authorMartin Tournoij <martin@arp242.net>
Sun, 16 Oct 2022 11:49:12 +0000 (12:49 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 16 Oct 2022 11:49:12 +0000 (12:49 +0100)
Problem:    Cannot always tell the difference beween tex and rexx files.
Solution:   Recognize tex by a leading backslash. (Martin Tournoij,
            closes #11380)

runtime/autoload/dist/ft.vim
src/testdir/test_filetype.vim
src/version.c

index 48eaf3f60f88274bedbae879396f15b7dae330f5..d5c21ac184261c40a7c9ded55d2924edee2079d4 100644 (file)
@@ -145,7 +145,7 @@ export def FTcls()
     return
   endif
 
-  if getline(1) =~ '^%'
+  if getline(1) =~ '^\v%(\%|\\)'
     setf tex
   elseif getline(1)[0] == '#' && getline(1) =~ 'rexx'
     setf rexx
index 0fb73b7dfd2fad19399233adcb175dd42858e971..281642ee9a6693c19c1d17f70469f656f7b1b3bb 100644 (file)
@@ -1741,6 +1741,11 @@ func Test_cls_file()
   call assert_equal('tex', &filetype)
   bwipe!
 
+  call writefile(['\NeedsTeXFormat{LaTeX2e}'], 'Xfile.cls')
+  split Xfile.cls
+  call assert_equal('tex', &filetype)
+  bwipe!
+
   " Rexx
 
   call writefile(['# rexx'], 'Xfile.cls')
index e9cacd59c1e619dbf6d85a5ed33d581884dfe699..1fc011ffbcc5ac0a8f7a3d9346f697da20c93ce0 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    771,
 /**/
     770,
 /**/