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:
Bram Moolenaar
2021-09-12 17:03:08 +02:00
parent dfe04dbff5
commit ca0627df69
3 changed files with 13 additions and 14 deletions

View File

@ -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