Patch 8.2.3679
Problem: objc file detected as Octave. (Antony Lee)
Solution: Detect objc by preprocessor lines. (Doug Kearns, closes #9223,
closes #9220)
Files: runtime/autoload/dist/ft.vim, src/testdir/test_filetype.vim
*** ../vim-8.2.3678/runtime/autoload/dist/ft.vim 2021-09-12 16:03:04.856023559 +0100
--- runtime/autoload/dist/ft.vim 2021-11-26 12:58:21.157048708 +0000
***************
*** 272,277 ****
--- 272,279 ----
" excluding end(for|function|if|switch|while) common to Murphi
let octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>'
+ let objc_preprocessor = '^\s*#\s*\%(import\|include\|define\|if\|ifn\=def\|undef\|line\|error\|pragma\)\>'
+
let n = 1
let saw_comment = 0 " Whether we've seen a multiline comment leader.
while n < 100
***************
*** 282,288 ****
" anything more definitive.
let saw_comment = 1
endif
! if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|//\)'
setf objc
return
endif
--- 284,290 ----
" anything more definitive.
let saw_comment = 1
endif
! if line =~ '^\s*//' || line =~ '^\s*@import\>' || line =~ objc_preprocessor
setf objc
return
endif
*** ../vim-8.2.3678/src/testdir/test_filetype.vim 2021-11-16 16:38:37.505604307 +0000
--- src/testdir/test_filetype.vim 2021-11-26 12:58:21.157048708 +0000
***************
*** 891,896 ****
--- 891,906 ----
call assert_equal('objc', &filetype)
bwipe!
+ call writefile(['#include <header.h>'], 'Xfile.m')
+ split Xfile.m
+ call assert_equal('objc', &filetype)
+ bwipe!
+
+ call writefile(['#define FORTY_TWO'], 'Xfile.m')
+ split Xfile.m
+ call assert_equal('objc', &filetype)
+ bwipe!
+
" Octave
call writefile(['# Octave line comment'], 'Xfile.m')
*** ../vim-8.2.3678/src/version.c 2021-11-25 20:40:07.327401285 +0000
--- src/version.c 2021-11-26 13:01:12.732501817 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3679,
/**/
--
Living on Earth includes an annual free trip around the Sun.
/// 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 ///