patch 9.1.1186: filetype: help files in git repos are not detected

Commit: 
https://github.com/vim/vim/commit/16d6fff98ed3a9dfd34a41696b005b0c4c7800f8
Author: David Mandelberg <da...@mandelberg.org>
Date:   Sat Mar 8 17:21:16 2025 +0100

    patch 9.1.1186: filetype: help files in git repos are not detected
    
    Problem:  filetype: help files in git repos are not detected
    Solution: detect */doc/*.txt files as help if they end with a help
              modeline, even if 'modeline' is off
    
    Here's how I checked that this would still detect vim's own help files
    correctly:
    
    $ find . -type f -path '*/doc/*.txt' \
    > -exec awk '{ } ENDFILE { print FILENAME ":" $0; }' '{}' + |
    > grep -v 'vim:.*\<\(ft\|filetype\)=help\>'
    ./src/libvterm/doc/seqs.txt: 23    DECSM 42         = DECNRCM, 
national/multinational character
    
    closes: #16817
    
    Signed-off-by: David Mandelberg <da...@mandelberg.org>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 9bdcfe0e3..cf9a82ac4 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 9.1.  Last change: 2025 Feb 21
+*todo.txt*      For Vim version 9.1.  Last change: 2025 Mar 08
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -6276,5 +6276,4 @@ Far future and "big" extensions:
     are reflected in each Vim immediately.  Could work with local files but
     also over the internet.  See http://www.codingmonkeys.de/subethaedit/.
 
-vim:tw=78:sw=4:sts=4:ts=8:noet:ft=help:norl:
-vim: set fo+=n :
+vim:tw=78:sw=4:sts=4:ts=8:noet:ft=help:norl:fo+=n:
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 8b4091ae7..0ee875ca7 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2025 Mar 06
+" Last Change: 2025 Mar 08
 " Former Maintainer:   Bram Moolenaar <b...@vim.org>
 
 " Listen very carefully, I will say this only once
@@ -51,8 +51,11 @@ func s:StarSetf(ft)
   endif
 endfunc
 
-" Vim help file
-au BufNewFile,BufRead $VIMRUNTIME/doc/*.txt    setf help
+" Vim help file, set ft explicitly, because 'modeline' might be off
+au BufNewFile,BufRead */doc/*.txt
+       \  if getline('$') =~ 'vim:.*\<\(ft\|filetype\)=help\>'
+       \|   setf help
+       \| endif
 
 " Abaqus or Trasys
 au BufNewFile,BufRead *.inp                    call dist#ft#Check_inp()
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index b6beb3f5d..521c0f60d 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -919,8 +919,6 @@ def s:GetFilenameChecks(): dict<list<string>>
           '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', 
'.zsh_history',
           '.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file',
           'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'],
-
-    help: [$VIMRUNTIME .. '/doc/help.txt'],
     }
 enddef
 
@@ -1626,6 +1624,23 @@ func Test_haredoc_file()
   filetype off
 endfunc
 
+func Test_help_file()
+  filetype on
+  call assert_true(mkdir('doc', 'pR'))
+
+  call writefile(['some text', 'vim:ft=help:'], 'doc/help.txt', 'D')
+  split doc/help.txt
+  call assert_equal('help', &filetype)
+  bwipe!
+
+  call writefile(['some text'], 'doc/nothelp.txt', 'D')
+  split doc/nothelp.txt
+  call assert_notequal('help', &filetype)
+  bwipe!
+
+  filetype off
+endfunc
+
 func Test_hook_file()
   filetype on
 
diff --git a/src/version.c b/src/version.c
index 1bfcbcbd0..5536a9b48 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1186,
 /**/
     1185,
 /**/

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/vim_dev/E1tqx3s-00G3Fg-A5%40256bit.org.

Raspunde prin e-mail lui