Patch 8.2.3432

5 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 12, 2021, 11:03:40 AM9/12/21
to vim...@googlegroups.com

Patch 8.2.3432
Problem: Octave/Matlab filetype detection does not work properly.
Solution: Update the patterns used for matching. (Doug Kearns)
Files: runtime/autoload/dist/ft.vim, src/testdir/test_filetype.vim


*** ../vim-8.2.3431/runtime/autoload/dist/ft.vim 2021-09-03 19:21:31.267026061 +0200
--- runtime/autoload/dist/ft.vim 2021-09-12 16:52:59.992792408 +0200
***************
*** 269,275 ****
return
endif

! let octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|for\|function\|if\|methods\|parfor\|properties\|switch\|while\)\>'

let n = 1
let saw_comment = 0 " Whether we've seen a multiline comment leader.
--- 269,276 ----
return
endif

! " 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,292 ****
setf objc
return
endif
! if line =~ '^\s*\%(#\|%!\|[#%]{\=\s*$\)' ||
! \ line =~ '^\s*unwind_protect\>' ||
\ line =~ '\%(^\|;\)\s*' .. octave_block_terminators
setf octave
return
--- 286,292 ----
setf objc
return
endif
! if line =~ '^\s*\%(#\|%!\)' || line =~ '^\s*unwind_protect\>' ||
\ line =~ '\%(^\|;\)\s*' .. octave_block_terminators
setf octave
return
*** ../vim-8.2.3431/src/testdir/test_filetype.vim 2021-09-03 19:21:31.271026051 +0200
--- src/testdir/test_filetype.vim 2021-09-12 16:52:59.992792408 +0200
***************
*** 893,908 ****
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)
--- 893,898 ----
***************
*** 913,919 ****
call assert_equal('octave', &filetype)
bwipe!

! call writefile(['function test(); 42; endfunction'], 'Xfile.m')
split Xfile.m
call assert_equal('octave', &filetype)
bwipe!
--- 903,909 ----
call assert_equal('octave', &filetype)
bwipe!

! call writefile(['try; 42; end_try_catch'], 'Xfile.m')
split Xfile.m
call assert_equal('octave', &filetype)
bwipe!
***************
*** 925,930 ****
--- 915,927 ----
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')
*** ../vim-8.2.3431/src/version.c 2021-09-12 15:45:06.690219391 +0200
--- src/version.c 2021-09-12 16:54:18.532695454 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3432,
/**/

--
I have a drinking problem -- I don't have a drink!

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages