Patch 9.0.0055
Problem: Bitbake files are not detected.
Solution: Add bitbake filetype detection by file name and contents. (Gregory
Anders, closes #10697)
Files: runtime/autoload/dist/ft.vim, runtime/filetype.vim,
src/testdir/test_filetype.vim
*** ../vim-9.0.0054/runtime/autoload/dist/ft.vim 2022-06-30
16:25:14.782979300 +0100
--- runtime/autoload/dist/ft.vim 2022-07-16 17:41:49.649586966 +0100
***************
*** 519,530 ****
# headers so assume POV-Ray
elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? ft_pascal_keywords
setf pascal
else
FTasmsyntax()
if exists("b:asmsyntax")
! exe "setf " .. fnameescape(b:asmsyntax)
else
! setf pov
endif
endif
endif
--- 519,532 ----
# headers so assume POV-Ray
elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? ft_pascal_keywords
setf pascal
+ elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '\w\+ = '
+ setf bitbake
else
FTasmsyntax()
if exists("b:asmsyntax")
! exe "setf " .. fnameescape(b:asmsyntax)
else
! setf pov
endif
endif
endif
*** ../vim-9.0.0054/runtime/filetype.vim 2022-07-09 20:27:02.939482453
+0100
--- runtime/filetype.vim 2022-07-16 17:41:49.649586966 +0100
***************
*** 252,257 ****
--- 252,260 ----
" Blank
au BufNewFile,BufRead *.bl setf blank
+ " Bitbake
+ au BufNewFile,BufRead
*.bb,*.bbappend,*.bbclass,*/build/conf/*.conf,*/meta{-*,}/conf/*.conf setf
bitbake
+
" Blkid cache file
au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml
*** ../vim-9.0.0054/src/testdir/test_filetype.vim 2022-07-09
20:27:02.939482453 +0100
--- src/testdir/test_filetype.vim 2022-07-16 17:41:49.649586966 +0100
***************
*** 83,88 ****
--- 83,89 ----
\ 'bib': ['file.bib'],
\ 'bicep': ['file.bicep'],
\ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file',
'any/bind/db.file', 'any/named/db.file'],
+ \ 'bitbake': ['file.bb', 'file.bbappend', 'file.bbclass',
'build/conf/local.conf', 'meta/conf/layer.conf', 'build/conf/bbappend.conf',
'meta-layer/conf/distro/foo.conf'],
\ 'blank': ['file.bl'],
\ 'bsdl': ['file.bsd', 'file.bsdl', 'bsd', 'some-bsd'],
\ 'bst': ['file.bst'],
***************
*** 1816,1820 ****
--- 1817,1874 ----
filetype off
endfunc
+ func Test_inc_file()
+ filetype on
+
+ call writefile(['this is the fallback'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('pov', &filetype)
+ bwipe!
+
+ let g:filetype_inc = 'foo'
+ split Xfile.inc
+ call assert_equal('foo', &filetype)
+ bwipe!
+ unlet g:filetype_inc
+
+ " aspperl
+ call writefile(['perlscript'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('aspperl', &filetype)
+ bwipe!
+
+ " aspvbs
+ call writefile(['<% something'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('aspvbs', &filetype)
+ bwipe!
+
+ " php
+ call writefile(['<?php'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('php', &filetype)
+ bwipe!
+
+ " pascal
+ call writefile(['program'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('pascal', &filetype)
+ bwipe!
+
+ " bitbake
+ call writefile(['require foo'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('bitbake', &filetype)
+ bwipe!
+
+ " asm
+ call writefile(['asmsyntax=foo'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('foo', &filetype)
+ bwipe!
+
+ call delete('Xfile.inc')
+ filetype off
+ endfunc
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0054/src/version.c 2022-07-15 20:45:11.130168352 +0100
--- src/version.c 2022-07-16 17:44:34.313705807 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 55,
/**/
--
>From "know your smileys":
<>:-) Bishop
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220716165812.D7DEA1C0909%40moolenaar.net.