]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1212: filetype: logrotate'd pacmanlogs are not recognized v9.1.1212
authorEisuke Kawashima <e-kwsm@users.noreply.github.com>
Sun, 16 Mar 2025 19:37:14 +0000 (20:37 +0100)
committerChristian Brabandt <cb@256bit.org>
Sun, 16 Mar 2025 19:37:14 +0000 (20:37 +0100)
Problem:  filetype: logrotate'd pacmanlogs are not recognized
Solution: also detect pacman.log* files as pacmanlog filetype,
          remove BufNewFile autocmd (Eisuke Kawashima)

closes: #16873

Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/filetype.vim
src/testdir/test_filetype.vim
src/version.c

index 44dec008fa915af083e07d6f5c4ff2cf7443defe..22324df8b3b7a7f8896e0c0a2eec56d5f7086800 100644 (file)
@@ -1814,7 +1814,7 @@ au BufNewFile,BufRead *.hook
 au BufNewFile,BufRead {.,}makepkg.conf                 setf sh
 
 " Pacman log
-au BufNewFile,BufRead pacman.log                       setf pacmanlog
+au BufRead pacman.log*                                 call s:StarSetf('pacmanlog')
 
 " Pam conf
 au BufNewFile,BufRead */etc/pam.conf                   setf pamconf
index 02cab62a437e05b04a32d36302c3b024f1c13d53..fe26d92561a88f1ce5fa79e48acb789d156dd9cf 100644 (file)
@@ -574,7 +574,6 @@ def s:GetFilenameChecks(): dict<list<string>>
     opl: ['file.OPL', 'file.OPl', 'file.OpL', 'file.Opl', 'file.oPL', 'file.oPl', 'file.opL', 'file.opl'],
     ora: ['file.ora'],
     org: ['file.org', 'file.org_archive'],
-    pacmanlog: ['pacman.log'],
     pamconf: ['/etc/pam.conf', '/etc/pam.d/file', 'any/etc/pam.conf', 'any/etc/pam.d/file'],
     pamenv: ['/etc/security/pam_env.conf', '/home/user/.pam_environment', '.pam_environment', 'pam_env.conf'],
     pandoc: ['file.pandoc', 'file.pdk', 'file.pd', 'file.pdc'],
@@ -2877,4 +2876,16 @@ func Test_org_file()
   filetype off
 endfunc
 
+" Filetypes detected from names of existing files
+func Test_pacmanlog()
+  filetype on
+  for fname in ['pacman.log', 'pacman.log.1', 'pacman.log-20250123']
+    call writefile(["[2025-01-23T01:23:45+0000] [PACMAN] Running 'pacman -S -y --config /etc/pacman.conf --'"], fname, 'D')
+    exe 'split ' .. fname
+    call assert_equal('pacmanlog', &filetype, 'for text: ' .. string(fname))
+    bwipe!
+  endfor
+  filetype off
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 812941804560ac81a469c686257c458048069b23..2da49520a88578ec2328d4c4906e8264a109c484 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1212,
 /**/
     1211,
 /**/