Patch 8.2.4464
Problem:    Dtrace files are recognized as filetype D.
Solution:   Add a pattern for Dtrace files. (Teubel György, closes #9841)
            Add some more testing.
Files:      runtime/autoload/dist/ft.vim, runtime/filetype.vim,
            src/testdir/test_filetype.vim


*** ../vim-8.2.4463/runtime/autoload/dist/ft.vim        2022-02-22 
21:17:36.675692322 +0000
--- runtime/autoload/dist/ft.vim        2022-02-24 17:46:11.336916240 +0000
***************
*** 206,211 ****
--- 206,215 ----
  enddef
  
  export def DtraceCheck()
+   if did_filetype()
+     # Filetype was already detected
+     return
+   endif
    var lines = getline(1, min([line("$"), 100]))
    if match(lines, '^module\>\|^import\>') > -1
      # D files often start with a module and/or import statement.
*** ../vim-8.2.4463/runtime/filetype.vim        2022-02-19 16:35:54.251967311 
+0000
--- runtime/filetype.vim        2022-02-24 17:46:11.336916240 +0000
***************
*** 484,489 ****
--- 484,490 ----
  au BufNewFile,BufRead *.desc                  setf desc
  
  " the D language or dtrace
+ au BufNewFile,BufRead */dtrace/*.d            setf dtrace
  au BufNewFile,BufRead *.d                     call dist#ft#DtraceCheck()
  
  " Desktop files
*** ../vim-8.2.4463/src/testdir/test_filetype.vim       2022-02-19 
16:35:54.251967311 +0000
--- src/testdir/test_filetype.vim       2022-02-24 17:56:01.972690680 +0000
***************
*** 132,137 ****
--- 132,138 ----
      \ 'cvs': ['cvs123'],
      \ 'cvsrc': ['.cvsrc'],
      \ 'cynpp': ['file.cyn'],
+     \ 'd': ['file.d'],
      \ 'dart': ['file.dart', 'file.drt'],
      \ 'datascript': ['file.ds'],
      \ 'dcd': ['file.dcd'],
***************
*** 154,159 ****
--- 155,161 ----
      \ 'dot': ['file.dot', 'file.gv'],
      \ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 
'lpe', 'lvs', 'some-lpe', 'some-lvs'],
      \ 'dtd': ['file.dtd'],
+     \ 'dtrace': ['/usr/lib/dtrace/io.d'],
      \ 'dts': ['file.dts', 'file.dtsi'],
      \ 'dune': ['jbuild', 'dune', 'dune-project', 'dune-workspace'],
      \ 'dylan': ['file.dylan'],
***************
*** 827,832 ****
--- 829,870 ----
    filetype off
  endfunc
  
+ func Test_d_file()
+   filetype on
+ 
+   call writefile(['looks like D'], 'Xfile.d')
+   split Xfile.d
+   call assert_equal('d', &filetype)
+   bwipe!
+ 
+   call writefile(['#!/some/bin/dtrace'], 'Xfile.d')
+   split Xfile.d
+   call assert_equal('dtrace', &filetype)
+   bwipe!
+ 
+   call writefile(['#pragma  D  option'], 'Xfile.d')
+   split Xfile.d
+   call assert_equal('dtrace', &filetype)
+   bwipe!
+ 
+   call writefile([':some:thing:'], 'Xfile.d')
+   split Xfile.d
+   call assert_equal('dtrace', &filetype)
+   bwipe!
+ 
+   call writefile(['module this', '#pragma  D  option'], 'Xfile.d')
+   split Xfile.d
+   call assert_equal('d', &filetype)
+   bwipe!
+ 
+   call writefile(['import that', '#pragma  D  option'], 'Xfile.d')
+   split Xfile.d
+   call assert_equal('d', &filetype)
+   bwipe!
+ 
+   filetype off
+ endfunc
+ 
  func Test_dep3patch_file()
    filetype on
  
*** ../vim-8.2.4463/src/version.c       2022-02-24 13:28:36.574222363 +0000
--- src/version.c       2022-02-24 17:57:01.632682007 +0000
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     4464,
  /**/

-- 
>From "know your smileys":
 C=}>;*{)) Drunk, devilish chef with a toupee in an updraft,
           a mustache, and a double chin

 /// 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/20220224175956.99EF21C1149%40moolenaar.net.

Raspunde prin e-mail lui