Patch 9.0.1643 Problem: Filetype detection fails if file name ends in many '~'. Solution: Strip multiple '~' at the same time. (closes #12553) Files: runtime/filetype.vim, src/testdir/test_filetype.vim
*** ../vim-9.0.1642/runtime/filetype.vim 2023-06-14 19:45:39.534903626 +0100 --- runtime/filetype.vim 2023-06-22 12:09:00.993020216 +0100 *************** *** 21,27 **** \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) au BufNewFile,BufRead *~ \ let s:name = expand("<afile>") | ! \ let s:short = substitute(s:name, '\~$', '', '') | \ if s:name != s:short && s:short != "" | \ exe "doau filetypedetect BufRead " . fnameescape(s:short) | \ endif | --- 21,27 ---- \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) au BufNewFile,BufRead *~ \ let s:name = expand("<afile>") | ! \ let s:short = substitute(s:name, '\~\+$', '', '') | \ if s:name != s:short && s:short != "" | \ exe "doau filetypedetect BufRead " . fnameescape(s:short) | \ endif | *** ../vim-9.0.1642/src/testdir/test_filetype.vim 2023-06-14 19:45:39.534903626 +0100 --- src/testdir/test_filetype.vim 2023-06-22 12:14:33.692618543 +0100 *************** *** 1,5 **** --- 1,16 ---- " Test :setfiletype + func Test_backup_strip() + filetype on + let fname = 'Xdetect.js~~~~~~~~~~~' + call writefile(['one', 'two', 'three'], fname, 'D') + exe 'edit ' .. fname + call assert_equal('javascript', &filetype) + + bwipe! + filetype off + endfunc + func Test_detection() filetype on augroup filetypedetect *** ../vim-9.0.1642/src/version.c 2023-06-21 15:51:43.278744288 +0100 --- src/version.c 2023-06-22 12:16:52.676468207 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1643, /**/ -- $ echo pizza > /dev/oven /// Bram Moolenaar -- b...@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 /// -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20230622112001.4DDFF1C0A9C%40moolenaar.net.