To: vim-dev@vim.org Subject: Patch 6.1a.040 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1a.040 Problem: A *.pl file is recognized as Perl, but it could be a prolog file. Solution: Check the first non-empty line. (Kontra Gergely) Files: runtime/filetype.vim *** ../vim61a.039/runtime/filetype.vim Sat Mar 9 14:31:15 2002 --- runtime/filetype.vim Fri Mar 1 21:48:28 2002 *************** *** 714,723 **** " Perl if has("fname_case") ! au BufNewFile,BufRead *.pl,*.PL setf perl else ! au BufNewFile,BufRead *.pl setf perl endif " Perl, XPM or XPM2 au BufNewFile,BufRead *.pm --- 714,738 ---- " Perl if has("fname_case") ! au BufNewFile,BufRead *.pl,*.PL call FTCheck_pl() else ! au BufNewFile,BufRead *.pl call FTCheck_pl() endif + + fun! FTCheck_pl() + if exists("g:filetype_pl") + exe "setf " . g:filetype_pl + else + " recognize Prolog by specific text in the first non-empty line + " require a blank after the '%' because Perl uses "%list" and "%translate" + let l = getline(nextnonblank(1)) + if l =~ '\' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-' + setf prolog + else + setf perl + endif + endif + endfun " Perl, XPM or XPM2 au BufNewFile,BufRead *.pm *** ../vim61a.039/src/version.c Sat Mar 9 14:31:15 2002 --- src/version.c Sat Mar 9 14:32:02 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 40, /**/ -- hundred-and-one symptoms of being an internet addict: 212. Your Internet group window has more icons than your Accessories window. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///