Patch 9.0.1601
Problem:    Filetype detection fails for *.conf file without comments.
            (Dmitrii Tcyganok)
Solution:   Use "conf" filetype as a fallback for an empty .conf file.
            (closes #12487, closes #12483)
Files:      runtime/filetype.vim, src/testdir/test_filetype.vim


*** ../vim-9.0.1600/runtime/filetype.vim        2023-05-28 22:11:17.800701909 
+0100
--- runtime/filetype.vim        2023-06-03 17:55:22.172195149 +0100
***************
*** 2811,2818 ****
  " Generic configuration file. Use FALLBACK, it's just guessing!
  au filetypedetect BufNewFile,BufRead,StdinReadPost *
        \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
!       \    && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
!       \       || getline(4) =~ '^#' || getline(5) =~ '^#') |
        \   setf FALLBACK conf |
        \ endif
  
--- 2811,2820 ----
  " Generic configuration file. Use FALLBACK, it's just guessing!
  au filetypedetect BufNewFile,BufRead,StdinReadPost *
        \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
!       \    && (expand("<amatch>") =~# '\.conf$'
!       \       || getline(1) =~ '^#' || getline(2) =~ '^#'
!       \       || getline(3) =~ '^#' || getline(4) =~ '^#'
!       \       || getline(5) =~ '^#') |
        \   setf FALLBACK conf |
        \ endif
  
*** ../vim-9.0.1600/src/testdir/test_filetype.vim       2023-05-29 
19:59:38.217805411 +0100
--- src/testdir/test_filetype.vim       2023-06-03 17:49:27.324471067 +0100
***************
*** 122,128 ****
      cobol: ['file.cbl', 'file.cob', 'file.lib'],
      coco: ['file.atg'],
      conaryrecipe: ['file.recipe'],
!     conf: ['auto.master'],
      config: ['configure.in', 'configure.ac', '/etc/hostname.file', 
'any/etc/hostname.file'],
      confini: ['/etc/pacman.conf', 'any/etc/pacman.conf', 'mpv.conf', 
'any/.aws/config', 'any/.aws/credentials', 'file.nmconnection'],
      context: ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 
'file.mkvi', 'file.mkxl', 'file.mklx'],
--- 122,128 ----
      cobol: ['file.cbl', 'file.cob', 'file.lib'],
      coco: ['file.atg'],
      conaryrecipe: ['file.recipe'],
!     conf: ['auto.master', 'file.conf'],
      config: ['configure.in', 'configure.ac', '/etc/hostname.file', 
'any/etc/hostname.file'],
      confini: ['/etc/pacman.conf', 'any/etc/pacman.conf', 'mpv.conf', 
'any/.aws/config', 'any/.aws/credentials', 'file.nmconnection'],
      context: ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 
'file.mkvi', 'file.mkxl', 'file.mklx'],
*** ../vim-9.0.1600/src/version.c       2023-06-03 17:11:40.789005400 +0100
--- src/version.c       2023-06-03 17:52:48.224109504 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1601,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
103. When you find yourself in the "Computer" section of Barnes & Noble
     enjoying yourself.

 /// 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/20230603165804.C08AB1C0595%40moolenaar.net.

Raspunde prin e-mail lui