changeset 30873:d4c8fdaa3ae7 v9.0.0771

patch 9.0.0771: cannot always tell the difference beween tex and rexx files Commit: https://github.com/vim/vim/commit/bd053f894b0d7652928201faa68c53d1ce2acdc5 Author: Martin Tournoij <martin@arp242.net> Date: Sun Oct 16 12:49:12 2022 +0100 patch 9.0.0771: cannot always tell the difference beween tex and rexx files Problem: Cannot always tell the difference beween tex and rexx files. Solution: Recognize tex by a leading backslash. (Martin Tournoij, closes #11380)
author Bram Moolenaar <Bram@vim.org>
date Sun, 16 Oct 2022 14:00:05 +0200
parents e96a9b7caa0d
children 479022a91414
files runtime/autoload/dist/ft.vim src/testdir/test_filetype.vim src/version.c
diffstat 3 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -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
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -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')
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    771,
+/**/
     770,
 /**/
     769,