Patch 9.0.1464
Problem: Strace filetype detection is expensive.
Solution: Match with a cheap pattern first. (Federico Mengozzi,
closes #12220)
Files: runtime/autoload/dist/script.vim, src/testdir/test_filetype.vim
*** ../vim-9.0.1463/runtime/autoload/dist/script.vim 2022-11-24
10:58:07.659390137 +0000
--- runtime/autoload/dist/script.vim 2023-04-17 22:30:03.237008075 +0100
***************
*** 338,344 ****
set ft=virata
# Strace
! elseif line1 =~ '[0-9:.]* *execve(' || line1 =~ '^__libc_start_main'
set ft=strace
# VSE JCL
--- 338,346 ----
set ft=virata
# Strace
! # inaccurate fast match first, then use accurate slow match
! elseif (line1 =~ 'execve(' && line1 =~ '^[0-9:.]* *execve(')
! || line1 =~ '^__libc_start_main'
set ft=strace
# VSE JCL
*** ../vim-9.0.1463/src/testdir/test_filetype.vim 2023-04-15
18:17:14.315951544 +0100
--- src/testdir/test_filetype.vim 2023-04-17 22:26:51.548979470 +0100
***************
*** 733,738 ****
--- 733,743 ----
filetype off
endfunc
+ " Content lines that should not result in filetype detection
+ let s:false_positive_checks = {
+ \ '': [['test execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars
*/) = 0']],
+ \ }
+
" Filetypes detected from the file contents by scripts.vim
let s:script_checks = {
\ 'virata': [['% Virata'],
***************
*** 824,829 ****
--- 829,835 ----
endfunc
func Test_script_detection()
+ call Run_script_detection(s:false_positive_checks)
call Run_script_detection(s:script_checks)
call Run_script_detection(s:script_env_checks)
endfunc
*** ../vim-9.0.1463/src/version.c 2023-04-17 21:44:32.436275188 +0100
--- src/version.c 2023-04-17 22:28:18.772995302 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1464,
/**/
--
How do you know when you have run out of invisible ink?
/// 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/20230417213214.717B51C042F%40moolenaar.net.