# HG changeset patch # User Bram Moolenaar # Date 1665921605 -7200 # Node ID d4c8fdaa3ae794f9ceef559bc0af910acccaf7ec # Parent e96a9b7caa0dc36b1a9e82dd6740eaf8493e370d 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 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) diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim --- 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 diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim --- 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') diff --git a/src/version.c b/src/version.c --- 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,