mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3432: octave/Matlab filetype detection does not work properly
Problem: Octave/Matlab filetype detection does not work properly. Solution: Update the patterns used for matching. (Doug Kearns)
This commit is contained in:
parent
dfe04dbff5
commit
ca0627df69
6
runtime/autoload/dist/ft.vim
vendored
6
runtime/autoload/dist/ft.vim
vendored
@ -269,7 +269,8 @@ func dist#ft#FTm()
|
|||||||
return
|
return
|
||||||
endif
|
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 n = 1
|
||||||
let saw_comment = 0 " Whether we've seen a multiline comment leader.
|
let saw_comment = 0 " Whether we've seen a multiline comment leader.
|
||||||
@ -285,8 +286,7 @@ func dist#ft#FTm()
|
|||||||
setf objc
|
setf objc
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
if line =~ '^\s*\%(#\|%!\|[#%]{\=\s*$\)' ||
|
if line =~ '^\s*\%(#\|%!\)' || line =~ '^\s*unwind_protect\>' ||
|
||||||
\ line =~ '^\s*unwind_protect\>' ||
|
|
||||||
\ line =~ '\%(^\|;\)\s*' .. octave_block_terminators
|
\ line =~ '\%(^\|;\)\s*' .. octave_block_terminators
|
||||||
setf octave
|
setf octave
|
||||||
return
|
return
|
||||||
|
@ -893,16 +893,6 @@ func Test_m_file()
|
|||||||
call assert_equal('octave', &filetype)
|
call assert_equal('octave', &filetype)
|
||||||
bwipe!
|
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')
|
call writefile(['%!test "Octave test"'], 'Xfile.m')
|
||||||
split Xfile.m
|
split Xfile.m
|
||||||
call assert_equal('octave', &filetype)
|
call assert_equal('octave', &filetype)
|
||||||
@ -913,7 +903,7 @@ func Test_m_file()
|
|||||||
call assert_equal('octave', &filetype)
|
call assert_equal('octave', &filetype)
|
||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
call writefile(['function test(); 42; endfunction'], 'Xfile.m')
|
call writefile(['try; 42; end_try_catch'], 'Xfile.m')
|
||||||
split Xfile.m
|
split Xfile.m
|
||||||
call assert_equal('octave', &filetype)
|
call assert_equal('octave', &filetype)
|
||||||
bwipe!
|
bwipe!
|
||||||
@ -925,6 +915,13 @@ func Test_m_file()
|
|||||||
call assert_equal('mma', &filetype)
|
call assert_equal('mma', &filetype)
|
||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
|
" MATLAB
|
||||||
|
|
||||||
|
call writefile(['% MATLAB line comment'], 'Xfile.m')
|
||||||
|
split Xfile.m
|
||||||
|
call assert_equal('matlab', &filetype)
|
||||||
|
bwipe!
|
||||||
|
|
||||||
" Murphi
|
" Murphi
|
||||||
|
|
||||||
call writefile(['-- Murphi comment'], 'Xfile.m')
|
call writefile(['-- Murphi comment'], 'Xfile.m')
|
||||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3432,
|
||||||
/**/
|
/**/
|
||||||
3431,
|
3431,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user