summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-09-12 17:03:08 +0200
committerBram Moolenaar <Bram@vim.org>2021-09-12 17:03:08 +0200
commitca0627df69c29508f6f797bef27a1f5fa9a447d3 (patch)
treec46daa76bf1ba8011468831de5524a41d19d0ea9
parentdfe04dbff5863f6c089da8831d7ac2a3421a44b7 (diff)
downloadvim-git-ca0627df69c29508f6f797bef27a1f5fa9a447d3.tar.gz
patch 8.2.3432: octave/Matlab filetype detection does not work properlyv8.2.3432
Problem: Octave/Matlab filetype detection does not work properly. Solution: Update the patterns used for matching. (Doug Kearns)
-rw-r--r--runtime/autoload/dist/ft.vim6
-rw-r--r--src/testdir/test_filetype.vim19
-rw-r--r--src/version.c2
3 files changed, 13 insertions, 14 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 48a9657cf..7484149a2 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -269,7 +269,8 @@ func dist#ft#FTm()
return
endif
- let octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|for\|function\|if\|methods\|parfor\|properties\|switch\|while\)\>'
+ " excluding end(for|function|if|switch|while) common to Murphi
+ let octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>'
let n = 1
let saw_comment = 0 " Whether we've seen a multiline comment leader.
@@ -285,8 +286,7 @@ func dist#ft#FTm()
setf objc
return
endif
- if line =~ '^\s*\%(#\|%!\|[#%]{\=\s*$\)' ||
- \ line =~ '^\s*unwind_protect\>' ||
+ if line =~ '^\s*\%(#\|%!\)' || line =~ '^\s*unwind_protect\>' ||
\ line =~ '\%(^\|;\)\s*' .. octave_block_terminators
setf octave
return
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 94db223f9..cd6e71d1b 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -893,16 +893,6 @@ func Test_m_file()
call assert_equal('octave', &filetype)
bwipe!
- call writefile(['#{', 'Octave block comment', '#}'], 'Xfile.m')
- split Xfile.m
- call assert_equal('octave', &filetype)
- bwipe!
-
- call writefile(['%{', 'Octave block comment', '%}'], 'Xfile.m')
- split Xfile.m
- call assert_equal('octave', &filetype)
- bwipe!
-
call writefile(['%!test "Octave test"'], 'Xfile.m')
split Xfile.m
call assert_equal('octave', &filetype)
@@ -913,7 +903,7 @@ func Test_m_file()
call assert_equal('octave', &filetype)
bwipe!
- call writefile(['function test(); 42; endfunction'], 'Xfile.m')
+ call writefile(['try; 42; end_try_catch'], 'Xfile.m')
split Xfile.m
call assert_equal('octave', &filetype)
bwipe!
@@ -925,6 +915,13 @@ func Test_m_file()
call assert_equal('mma', &filetype)
bwipe!
+ " MATLAB
+
+ call writefile(['% MATLAB line comment'], 'Xfile.m')
+ split Xfile.m
+ call assert_equal('matlab', &filetype)
+ bwipe!
+
" Murphi
call writefile(['-- Murphi comment'], 'Xfile.m')
diff --git a/src/version.c b/src/version.c
index 053648a55..7d87105b6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3432,
+/**/
3431,
/**/
3430,