patch 9.2.0539: filetype: too many Bitbake include files are recognized
Commit:
https://github.com/vim/vim/commit/2df68c8e4bc03a5222218e22e74897861b8c1896
Author: Martin Schwan <[email protected]>
Date: Tue May 26 18:41:11 2026 +0000
patch 9.2.0539: filetype: too many Bitbake include files are recognized
Problem: filetype: too many Bitbake include files are recognized
(Brahmajit Das, after v9.1.1732)
Solution: Tighten the pattern to detect BitBake include files, update
tests (Martin Schwan).
Be more strict when detecting BitBake inc files. In particular, only
match include keywords and variable assignments at the beginning of a
line (excluding whitespace).
Use non-capturing groups to slightly improve performance.
Use regex or-operators to exactly match BitBake assignment operators.
The previous expression would falsely match
FOO .=. "bar"
, which is not valid BitBake syntax. The new capturing group is more
specific and matches only valid assignments.
fixes: #20288
closes: #20335
Signed-off-by: Martin Schwan <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index c2f3e2afd..f7d42d7f9 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -920,7 +920,7 @@ export def FTinc()
elseif line =~ '^\s*\%({\|(\*\)' || line =~? ft_pascal_keywords
setf pascal
return
- elseif line =~# '\<\%(require\|inherit\)\>' || line =~#
'[A-Z][A-Za-z0-9_:${}/]*\(\[[A-Za-z0-9_:/]\+\]\)*\s\+\%(??\|[?:+.]\)\?=.\? '
+ elseif line =~# '^\s*\<\%(require\|inherit\)\>' || line =~#
'^\s*[A-Z][A-Za-z0-9_:${}/]*\%(\[[A-Za-z0-9_:/]\+\]\)*\s\+\%(??=\|[?:+.]=\|=[+.]\?\)\s\+'
setf bitbake
return
endif
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 47df92d0b..23651f44b 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -2831,11 +2831,17 @@ endfunc
func Test_inc_file()
filetype on
+ " pov
call writefile(['this is the fallback'], 'Xfile.inc', 'D')
split Xfile.inc
call assert_equal('pov', &filetype)
bwipe!
+ call writefile(['!Comment with formular a = b/c'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('pov', &filetype)
+ bwipe!
+
" ObjectScript routine
call writefile(['ROUTINE Sample [Type=INC]'], 'Xfile.inc', 'D')
split Xfile.inc
@@ -2888,6 +2894,11 @@ func Test_inc_file()
call assert_equal('bitbake', &filetype)
bwipe!
+ call writefile(['MACHINE ?= "qemu"'], 'Xfile.inc')
+ split Xfile.inc
+ call assert_equal('bitbake', &filetype)
+ bwipe!
+
call writefile(['MACHINE ??= "qemu"'], 'Xfile.inc')
split Xfile.inc
call assert_equal('bitbake', &filetype)
diff --git a/src/version.c b/src/version.c
index 0707c875d..3be49ccbc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 539,
/**/
538,
/**/
--
--
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 visit
https://groups.google.com/d/msgid/vim_dev/E1wRwm2-007uzw-OW%40256bit.org.