Patch 8.2.3050
Problem:    Cannot recognize elixir files.
Solution:   Recognize Elixir-specific files.  Check if an .ex file is Euphoria
            or Elixir. (Austin Gatlin, closes #8401, closes #8446)
Files:      runtime/autoload/dist/ft.vim, runtime/filetype.vim,
            src/testdir/test_filetype.vim


*** ../vim-8.2.3049/runtime/autoload/dist/ft.vim        2021-01-12 
17:42:20.949763884 +0100
--- runtime/autoload/dist/ft.vim        2021-06-26 12:00:31.472878676 +0200
***************
*** 172,177 ****
--- 172,188 ----
    setf dtd
  endfunc
  
+ func dist#ft#ExCheck()
+   let lines = getline(1, min([line("$"), 100]))
+   if exists('g:filetype_euphoria')
+     exe 'setf ' . g:filetype_euphoria
+   elseif match(lines, '^--\|^ifdef\>\|^include\>') > -1
+     setf euphoria3
+   else
+     setf elixir
+   endif
+ endfunc
+ 
  func dist#ft#EuphoriaCheck()
    if exists('g:filetype_euphoria')
      exe 'setf ' . g:filetype_euphoria
*** ../vim-8.2.3049/runtime/filetype.vim        2021-06-25 21:54:22.016894907 
+0200
--- runtime/filetype.vim        2021-06-26 12:00:31.472878676 +0200
***************
*** 393,399 ****
  " Configure scripts
  au BufNewFile,BufRead configure.in,configure.ac setf config
  
! " CUDA  Cumpute Unified Device Architecture
  au BufNewFile,BufRead *.cu,*.cuh              setf cuda
  
  " Dockerfile; Podman uses the same syntax with name Containerfile
--- 393,399 ----
  " Configure scripts
  au BufNewFile,BufRead configure.in,configure.ac setf config
  
! " CUDA Compute Unified Device Architecture
  au BufNewFile,BufRead *.cu,*.cuh              setf cuda
  
  " Dockerfile; Podman uses the same syntax with name Containerfile
***************
*** 408,415 ****
  " Eterm
  au BufNewFile,BufRead *Eterm/*.cfg            setf eterm
  
  " Euphoria 3 or 4
! au BufNewFile,BufRead *.eu,*.ew,*.ex,*.exu,*.exw  call dist#ft#EuphoriaCheck()
  if has("fname_case")
     au BufNewFile,BufRead *.EU,*.EW,*.EX,*.EXU,*.EXW  call 
dist#ft#EuphoriaCheck()
  endif
--- 408,422 ----
  " Eterm
  au BufNewFile,BufRead *Eterm/*.cfg            setf eterm
  
+ " Elixir or Euphoria
+ au BufNewFile,BufRead *.ex call dist#ft#ExCheck()
+ 
+ " Elixir
+ au BufRead,BufNewFile mix.lock,*.exs setf elixir
+ au BufRead,BufNewFile *.eex,*.leex setf eelixir
+ 
  " Euphoria 3 or 4
! au BufNewFile,BufRead *.eu,*.ew,*.exu,*.exw  call dist#ft#EuphoriaCheck()
  if has("fname_case")
     au BufNewFile,BufRead *.EU,*.EW,*.EX,*.EXU,*.EXW  call 
dist#ft#EuphoriaCheck()
  endif
*** ../vim-8.2.3049/src/testdir/test_filetype.vim       2021-06-25 
21:54:22.016894907 +0200
--- src/testdir/test_filetype.vim       2021-06-26 12:00:31.472878676 +0200
***************
*** 161,166 ****
--- 161,168 ----
      \ 'ecd': ['file.ecd'],
      \ 'edif': ['file.edf', 'file.edif', 'file.edo'],
      \ 'elinks': ['elinks.conf'],
+     \ 'elixir': ['file.ex', 'file.exs', 'mix.lock'],
+     \ 'eelixir': ['file.eex', 'file.leex'],
      \ 'elm': ['file.elm'],
      \ 'elmfilt': ['filter-rules'],
      \ 'epuppet': ['file.epp'],
***************
*** 790,794 ****
--- 792,832 ----
    filetype off
  endfunc
  
+ func Test_ex_file()
+   filetype on
+ 
+   call writefile(['arbitrary content'], 'Xfile.ex')
+   split Xfile.ex
+   call assert_equal('elixir', &filetype)
+   bwipe!
+   let g:filetype_euphoria = 'euphoria4'
+   split Xfile.ex
+   call assert_equal('euphoria4', &filetype)
+   bwipe!
+   unlet g:filetype_euphoria
+ 
+   call writefile(['-- filetype euphoria comment'], 'Xfile.ex')
+   split Xfile.ex
+   call assert_equal('euphoria3', &filetype)
+   bwipe!
+ 
+   call writefile(['--filetype euphoria comment'], 'Xfile.ex')
+   split Xfile.ex
+   call assert_equal('euphoria3', &filetype)
+   bwipe!
+ 
+   call writefile(['ifdef '], 'Xfile.ex')
+   split Xfile.ex
+   call assert_equal('euphoria3', &filetype)
+   bwipe!
+ 
+   call writefile(['include '], 'Xfile.ex')
+   split Xfile.ex
+   call assert_equal('euphoria3', &filetype)
+   bwipe!
+ 
+   call delete('Xfile.ex')
+   filetype off
+ endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3049/src/version.c       2021-06-25 21:54:22.016894907 +0200
--- src/version.c       2021-06-26 12:02:22.120636452 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3050,
  /**/

-- 
Q. What happens to programmers when they die?
A: MS-Windows programmers are reinstalled.  C++ programmers become undefined,
   anyone who refers to them will die as well. Java programmers reincarnate
   after being garbage collected, unless they are in permgen, in which case
   they become zombies.  Zimbu programmers leave a stack trace that tells us
   exactly where they died and how they got there.

 /// 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/202106261004.15QA4HkR286924%40masaka.moolenaar.net.

Raspunde prin e-mail lui