patch 9.1.1327: filetype: nroff detection can be improved
Problem: filetype: nroff detection can be improved
Solution: improve nroff detection (Eisuke Kawashima)
- explicitly check roff comments and macros typically found in manpages
- do not try to detect alphabetically-sectioned files, except for n, as
nroff
- l: > 'l' happens to be a section for historical reasons
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=391977>
- n: e.g. /usr/share/man/mann/Tcl.n.gz
- o: unsure (perhaps fedora-specific)
- p: unsure (perhaps fedora-specific)
closes: #17160
Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index d241276..a7bb8bf 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -2955,11 +2955,21 @@
func Test_nroff_file()
filetype on
- call writefile(['.TH vim 1 "YYYY Mth DD"'], 'Xfile.1', 'D')
+ call writefile(['.TH VIM 1 "YYYY Mth DD"'], 'Xfile.1', 'D')
split Xfile.1
call assert_equal('nroff', &filetype)
bwipe!
+ call writefile(['.Dd $Mdocdate$', '.Dt "DETECTION TEST" "7"', '.Os'], 'Xfile.7', 'D')
+ split Xfile.7
+ call assert_equal('nroff', &filetype)
+ bwipe!
+
+ call writefile(['''\" t'], 'Xfile.3p', 'D')
+ split Xfile.3p
+ call assert_equal('nroff', &filetype)
+ bwipe!
+
call writefile(['. /etc/profile'], 'Xfile.1', 'D')
split Xfile.1
call assert_notequal('nroff', &filetype)
diff --git a/src/version.c b/src/version.c
index 3b90185..36e94bc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1327,
+/**/
1326,
/**/
1325,