]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1713: filetype: fvwm2m4 files are no longer detected v9.1.1713
authorzeertzjq <zeertzjq@outlook.com>
Fri, 29 Aug 2025 16:31:29 +0000 (18:31 +0200)
committerChristian Brabandt <cb@256bit.org>
Fri, 29 Aug 2025 16:32:41 +0000 (18:32 +0200)
Problem:  filetype: fvwm2m4 files are no longer recognized
          (after 9.1.1687).
Solution: Add a special case in m4 filetype detection (zeertzjq).

closes: #18146

Co-authored-by: Damien Lejay <damien@lejay.be>
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/dist/ft.vim
runtime/filetype.vim
src/testdir/test_filetype.vim
src/version.c

index 2172626dc45f6bb2bb27f795010b0e77720f2fec..bb2bc2c1c58e96ee94908b90fc577fbb99a30b25 100644 (file)
@@ -601,31 +601,36 @@ enddef
 
 # For files ending in *.m4, distinguish:
 #  – *.html.m4 files
+#  - *fvwm2rc*.m4 files
 #  – files in the Autoconf M4 dialect
 #  – files in POSIX M4
 export def FTm4()
   var fname = expand('%:t')
   var path  = expand('%:p:h')
 
-  # Case 0: canonical Autoconf file
-  if fname ==# 'aclocal.m4'
-    setf config
+  if fname =~# 'html\.m4$'
+    setf htmlm4
     return
   endif
 
-  # Case 1: html.m4
-  if fname =~# 'html\.m4$'
-    setf htmlm4
+  if fname =~# 'fvwm2rc'
+    setf fvwm2m4
+    return
+  endif
+
+  # Canonical Autoconf file
+  if fname ==# 'aclocal.m4'
+    setf config
     return
   endif
 
-  # Case 2: repo heuristic (nearby configure.ac)
+  # Repo heuristic for Autoconf M4 (nearby configure.ac)
   if filereadable(path .. '/../configure.ac') || filereadable(path .. '/configure.ac')
     setf config
     return
   endif
 
-  # Case 3: content heuristic (scan first ~200 lines)
+  # Content heuristic for Autoconf M4 (scan first ~200 lines)
   # Signals:
   #   - Autoconf macro prefixes: AC_/AM_/AS_/AU_/AT_
   var n = 1
@@ -639,7 +644,7 @@ export def FTm4()
     n += 1
   endwhile
 
-  # Case 4: default to POSIX M4
+  # Default to POSIX M4
   setf m4
 enddef
 
index 0c9f341891218301857edc9044d29ed47de4748b..35238298a301affb34c4f1c870be68feb0584903 100644 (file)
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:          The Vim Project <https://github.com/vim/vim>
-" Last Change:         2025 Aug 26
+" Last Change:         2025 Aug 29
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " Listen very carefully, I will say this only once
@@ -1519,7 +1519,7 @@ au BufNewFile,BufRead *.lsl                       call dist#ft#FTlsl()
 au BufNewFile,BufRead *.lss                    setf lss
 
 " M4
-au BufNewFile,BufRead *.m4                      call dist#ft#FTm4()
+au BufNewFile,BufRead *.m4     call dist#ft#FTm4()
 
 au BufNewFile,BufRead .m4_history              setf m4
 
@@ -3190,11 +3190,7 @@ au BufNewFile,BufRead */.fvwm/*                  call s:StarSetf('fvwm')
 au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook
        \ let b:fvwm_version = 1 | call s:StarSetf('fvwm')
 au BufNewFile,BufRead *fvwm2rc*
-       \ if expand("<afile>:e") == "m4"
-       \|  call s:StarSetf('fvwm2m4')
-       \|else
-       \|  let b:fvwm_version = 2 | call s:StarSetf('fvwm')
-       \|endif
+       \ let b:fvwm_version = 2 | call s:StarSetf('fvwm')
 
 " Gedcom
 au BufNewFile,BufRead */tmp/lltmp*             call s:StarSetf('gedcom')
index 0d97cfd0c9f917818745281d3db5e176bf7a462f..6fff0281a827137c5e675486572aeeaaf81a6c30 100644 (file)
@@ -308,7 +308,8 @@ def s:GetFilenameChecks(): dict<list<string>>
     fstab: ['fstab', 'mtab'],
     func: ['file.fc'],
     fusion: ['file.fusion'],
-    fvwm: ['/.fvwm/file', 'any/.fvwm/file'],
+    fvwm: ['/.fvwm/file', 'any/.fvwm/file', '.fvwmrc', 'foo.fvwmrc', 'fvwmrc.foo', '.fvwm2rc', 'foo.fvwm2rc', 'fvwm2rc.foo', 'foo.fvwm95.hook', 'fvwm95.foo.hook'],
+    fvwm2m4: ['.fvwm2rc.m4', 'foo.fvwm2rc.m4', 'fvwm2rc.foo.m4'],
     gdb: ['.gdbinit', 'gdbinit', '.cuda-gdbinit', 'cuda-gdbinit', 'file.gdb', '.config/gdbearlyinit', '.gdbearlyinit'],
     gdmo: ['file.mo', 'file.gdmo'],
     gdresource: ['file.tscn', 'file.tres'],
index afe7c45b61d9d5895462bff330bac1276f656387..4a04a97b8d3610251e794e546a6e3a86f9b2e2fa 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1713,
 /**/
     1712,
 /**/