Patch 9.0.1519 Problem: Global 'filetype' is set when it is detected from the file content. Solution: Set the local 'filetype' option value. Files: runtime/autoload/dist/script.vim
*** ../vim-9.0.1518/runtime/autoload/dist/script.vim 2023-04-17 22:31:32.565014586 +0100 --- runtime/autoload/dist/script.vim 2023-05-06 21:19:53.336817904 +0100 *************** *** 71,201 **** # Z shell scripts elseif name =~ '^zsh\>' ! set ft=zsh # TCL scripts elseif name =~ '^\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>' ! set ft=tcl # Expect scripts elseif name =~ '^expect\>' ! set ft=expect # Gnuplot scripts elseif name =~ '^gnuplot\>' ! set ft=gnuplot # Makefiles elseif name =~ 'make\>' ! set ft=make # Pike elseif name =~ '^pike\%(\>\|[0-9]\)' ! set ft=pike # Lua elseif name =~ 'lua' ! set ft=lua # Perl elseif name =~ 'perl' ! set ft=perl # PHP elseif name =~ 'php' ! set ft=php # Python elseif name =~ 'python' ! set ft=python # Groovy elseif name =~ '^groovy\>' ! set ft=groovy # Raku elseif name =~ 'raku' ! set ft=raku # Ruby elseif name =~ 'ruby' ! set ft=ruby # JavaScript elseif name =~ 'node\(js\)\=\>\|js\>' || name =~ 'rhino\>' ! set ft=javascript # BC calculator elseif name =~ '^bc\>' ! set ft=bc # sed elseif name =~ 'sed\>' ! set ft=sed # OCaml-scripts elseif name =~ 'ocaml' ! set ft=ocaml # Awk scripts; also finds "gawk" elseif name =~ 'awk\>' ! set ft=awk # Website MetaLanguage elseif name =~ 'wml' ! set ft=wml # Scheme scripts elseif name =~ 'scheme' ! set ft=scheme # CFEngine scripts elseif name =~ 'cfengine' ! set ft=cfengine # Erlang scripts elseif name =~ 'escript' ! set ft=erlang # Haskell elseif name =~ 'haskell' ! set ft=haskell # Scala elseif name =~ 'scala\>' ! set ft=scala # Clojure elseif name =~ 'clojure' ! set ft=clojure # Free Pascal elseif name =~ 'instantfpc\>' ! set ft=pascal # Fennel elseif name =~ 'fennel\>' ! set ft=fennel # MikroTik RouterOS script elseif name =~ 'rsc\>' ! set ft=routeros # Fish shell elseif name =~ 'fish\>' ! set ft=fish # Gforth elseif name =~ 'gforth\>' ! set ft=forth # Icon elseif name =~ 'icon\>' ! set ft=icon # Guile elseif name =~ 'guile' ! set ft=scheme endif enddef --- 71,201 ---- # Z shell scripts elseif name =~ '^zsh\>' ! setl ft=zsh # TCL scripts elseif name =~ '^\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>' ! setl ft=tcl # Expect scripts elseif name =~ '^expect\>' ! setl ft=expect # Gnuplot scripts elseif name =~ '^gnuplot\>' ! setl ft=gnuplot # Makefiles elseif name =~ 'make\>' ! setl ft=make # Pike elseif name =~ '^pike\%(\>\|[0-9]\)' ! setl ft=pike # Lua elseif name =~ 'lua' ! setl ft=lua # Perl elseif name =~ 'perl' ! setl ft=perl # PHP elseif name =~ 'php' ! setl ft=php # Python elseif name =~ 'python' ! setl ft=python # Groovy elseif name =~ '^groovy\>' ! setl ft=groovy # Raku elseif name =~ 'raku' ! setl ft=raku # Ruby elseif name =~ 'ruby' ! setl ft=ruby # JavaScript elseif name =~ 'node\(js\)\=\>\|js\>' || name =~ 'rhino\>' ! setl ft=javascript # BC calculator elseif name =~ '^bc\>' ! setl ft=bc # sed elseif name =~ 'sed\>' ! setl ft=sed # OCaml-scripts elseif name =~ 'ocaml' ! setl ft=ocaml # Awk scripts; also finds "gawk" elseif name =~ 'awk\>' ! setl ft=awk # Website MetaLanguage elseif name =~ 'wml' ! setl ft=wml # Scheme scripts elseif name =~ 'scheme' ! setl ft=scheme # CFEngine scripts elseif name =~ 'cfengine' ! setl ft=cfengine # Erlang scripts elseif name =~ 'escript' ! setl ft=erlang # Haskell elseif name =~ 'haskell' ! setl ft=haskell # Scala elseif name =~ 'scala\>' ! setl ft=scala # Clojure elseif name =~ 'clojure' ! setl ft=clojure # Free Pascal elseif name =~ 'instantfpc\>' ! setl ft=pascal # Fennel elseif name =~ 'fennel\>' ! setl ft=fennel # MikroTik RouterOS script elseif name =~ 'rsc\>' ! setl ft=routeros # Fish shell elseif name =~ 'fish\>' ! setl ft=fish # Gforth elseif name =~ 'gforth\>' ! setl ft=forth # Icon elseif name =~ 'icon\>' ! setl ft=icon # Guile elseif name =~ 'guile' ! setl ft=scheme endif enddef *************** *** 218,245 **** || "\n" .. line1 .. "\n" .. line2 .. "\n" .. line3 .. "\n" .. line4 .. "\n" .. line5 =~ '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>' ! set ft=zsh # ELM Mail files elseif line1 =~ '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$' ! set ft=mail # Mason elseif line1 =~ '^<[%&].*>' ! set ft=mason # Vim scripts (must have '" vim' as the first line to trigger this) elseif line1 =~ '^" *[vV]im$' ! set ft=vim # libcxx and libstdc++ standard library headers like "iostream" do not have # an extension, recognize the Emacs file mode. elseif line1 =~? '-\*-.*C++.*-\*-' ! set ft=cpp # MOO elseif line1 =~ '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$' ! set ft=moo # Diff file: # - "diff" in first line (context diff) --- 218,245 ---- || "\n" .. line1 .. "\n" .. line2 .. "\n" .. line3 .. "\n" .. line4 .. "\n" .. line5 =~ '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>' ! setl ft=zsh # ELM Mail files elseif line1 =~ '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$' ! setl ft=mail # Mason elseif line1 =~ '^<[%&].*>' ! setl ft=mason # Vim scripts (must have '" vim' as the first line to trigger this) elseif line1 =~ '^" *[vV]im$' ! setl ft=vim # libcxx and libstdc++ standard library headers like "iostream" do not have # an extension, recognize the Emacs file mode. elseif line1 =~? '-\*-.*C++.*-\*-' ! setl ft=cpp # MOO elseif line1 =~ '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$' ! setl ft=moo # Diff file: # - "diff" in first line (context diff) *************** *** 258,268 **** || (line1 =~ '^\*\*\* ' && line2 =~ '^--- ') || (line1 =~ '^=== ' && ((line2 =~ '^=\{66\}' && line3 =~ '^--- ' && line4 =~ '^+++') || (line2 =~ '^--- ' && line3 =~ '^+++ '))) || (line1 =~ '^=== \(removed\|added\|renamed\|modified\)') ! set ft=diff # PostScript Files (must have %!PS as the first line, like a2ps output) elseif line1 =~ '^%![ \t]*PS' ! set ft=postscr # M4 scripts: Guess there is a line that starts with "dnl". elseif line1 =~ '^\s*dnl\>' --- 258,268 ---- || (line1 =~ '^\*\*\* ' && line2 =~ '^--- ') || (line1 =~ '^=== ' && ((line2 =~ '^=\{66\}' && line3 =~ '^--- ' && line4 =~ '^+++') || (line2 =~ '^--- ' && line3 =~ '^+++ '))) || (line1 =~ '^=== \(removed\|added\|renamed\|modified\)') ! setl ft=diff # PostScript Files (must have %!PS as the first line, like a2ps output) elseif line1 =~ '^%![ \t]*PS' ! setl ft=postscr # M4 scripts: Guess there is a line that starts with "dnl". elseif line1 =~ '^\s*dnl\>' *************** *** 270,333 **** || line3 =~ '^\s*dnl\>' || line4 =~ '^\s*dnl\>' || line5 =~ '^\s*dnl\>' ! set ft=m4 # AmigaDos scripts elseif $TERM == "amiga" && (line1 =~ "^;" || line1 =~? '^\.bra') ! set ft=amiga # SiCAD scripts (must have procn or procd as the first line to trigger this) elseif line1 =~? '^ *proc[nd] *$' ! set ft=sicad # Purify log files start with "**** Purify" elseif line1 =~ '^\*\*\*\* Purify' ! set ft=purifylog # XML elseif line1 =~ '<?\s*xml.*?>' ! set ft=xml # XHTML (e.g.: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN") elseif line1 =~ '\<DTD\s\+XHTML\s' ! set ft=xhtml # HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN") # Avoid "doctype html", used by slim. elseif line1 =~? '<!DOCTYPE\s\+html\>' ! set ft=html # PDF elseif line1 =~ '^%PDF-' ! set ft=pdf # XXD output elseif line1 =~ '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} ' ! set ft=xxd # RCS/CVS log output elseif line1 =~ '^RCS file:' || line2 =~ '^RCS file:' ! set ft=rcslog # CVS commit elseif line2 =~ '^CVS:' || getline("$") =~ '^CVS: ' ! set ft=cvs # Prescribe elseif line1 =~ '^!R!' ! set ft=prescribe # Send-pr elseif line1 =~ '^SEND-PR:' ! set ft=sendpr # SNNS files elseif line1 =~ '^SNNS network definition file' ! set ft=snnsnet elseif line1 =~ '^SNNS pattern definition file' ! set ft=snnspat elseif line1 =~ '^SNNS result file' ! set ft=snnsres # Virata elseif line1 =~ '^%.\{-}[Vv]irata' --- 270,333 ---- || line3 =~ '^\s*dnl\>' || line4 =~ '^\s*dnl\>' || line5 =~ '^\s*dnl\>' ! setl ft=m4 # AmigaDos scripts elseif $TERM == "amiga" && (line1 =~ "^;" || line1 =~? '^\.bra') ! setl ft=amiga # SiCAD scripts (must have procn or procd as the first line to trigger this) elseif line1 =~? '^ *proc[nd] *$' ! setl ft=sicad # Purify log files start with "**** Purify" elseif line1 =~ '^\*\*\*\* Purify' ! setl ft=purifylog # XML elseif line1 =~ '<?\s*xml.*?>' ! setl ft=xml # XHTML (e.g.: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN") elseif line1 =~ '\<DTD\s\+XHTML\s' ! setl ft=xhtml # HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN") # Avoid "doctype html", used by slim. elseif line1 =~? '<!DOCTYPE\s\+html\>' ! setl ft=html # PDF elseif line1 =~ '^%PDF-' ! setl ft=pdf # XXD output elseif line1 =~ '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} ' ! setl ft=xxd # RCS/CVS log output elseif line1 =~ '^RCS file:' || line2 =~ '^RCS file:' ! setl ft=rcslog # CVS commit elseif line2 =~ '^CVS:' || getline("$") =~ '^CVS: ' ! setl ft=cvs # Prescribe elseif line1 =~ '^!R!' ! setl ft=prescribe # Send-pr elseif line1 =~ '^SEND-PR:' ! setl ft=sendpr # SNNS files elseif line1 =~ '^SNNS network definition file' ! setl ft=snnsnet elseif line1 =~ '^SNNS pattern definition file' ! setl ft=snnspat elseif line1 =~ '^SNNS result file' ! setl ft=snnsres # Virata elseif line1 =~ '^%.\{-}[Vv]irata' *************** *** 335,415 **** || line3 =~ '^%.\{-}[Vv]irata' || line4 =~ '^%.\{-}[Vv]irata' || line5 =~ '^%.\{-}[Vv]irata' ! set ft=virata # Strace # inaccurate fast match first, then use accurate slow match elseif (line1 =~ 'execve(' && line1 =~ '^[0-9:.]* *execve(') || line1 =~ '^__libc_start_main' ! set ft=strace # VSE JCL elseif line1 =~ '^\* $$ JOB\>' || line1 =~ '^// *JOB\>' ! set ft=vsejcl # TAK and SINDA elseif line4 =~ 'K & K Associates' || line2 =~ 'TAK 2000' ! set ft=takout elseif line3 =~ 'S Y S T E M S I M P R O V E D ' ! set ft=sindaout elseif getline(6) =~ 'Run Date: ' ! set ft=takcmp elseif getline(9) =~ 'Node File 1' ! set ft=sindacmp # DNS zone files elseif line1 .. line2 .. line3 .. line4 =~ '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA' ! set ft=bindzone # BAAN elseif line1 =~ '|\*\{1,80}' && line2 =~ 'VRC ' || line2 =~ '|\*\{1,80}' && line3 =~ 'VRC ' ! set ft=baan # Valgrind elseif line1 =~ '^==\d\+== valgrind' || line3 =~ '^==\d\+== Using valgrind' ! set ft=valgrind # Go docs elseif line1 =~ '^PACKAGE DOCUMENTATION$' ! set ft=godoc # Renderman Interface Bytestream elseif line1 =~ '^##RenderMan' ! set ft=rib # Scheme scripts elseif line1 =~ 'exec\s\+\S*scheme' || line2 =~ 'exec\s\+\S*scheme' ! set ft=scheme # Git output elseif line1 =~ '^\(commit\|tree\|object\) \x\{40,\}\>\|^tag \S\+$' ! set ft=git # Gprof (gnu profiler) elseif line1 == 'Flat profile:' && line2 == '' && line3 =~ '^Each sample counts as .* seconds.$' ! set ft=gprof # Erlang terms # (See also: http://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html#Choosing-Modes) elseif line1 =~? '-\*-.*erlang.*-\*-' ! set ft=erlang # YAML elseif line1 =~ '^%YAML' ! set ft=yaml # MikroTik RouterOS script elseif line1 =~ '^#.*by RouterOS.*$' ! set ft=routeros # Sed scripts # #ncomment is allowed but most likely a false positive so require a space # before any trailing comment text elseif line1 =~ '^#n\%($\|\s\)' ! set ft=sed else var lnum = 1 --- 335,415 ---- || line3 =~ '^%.\{-}[Vv]irata' || line4 =~ '^%.\{-}[Vv]irata' || line5 =~ '^%.\{-}[Vv]irata' ! setl ft=virata # Strace # inaccurate fast match first, then use accurate slow match elseif (line1 =~ 'execve(' && line1 =~ '^[0-9:.]* *execve(') || line1 =~ '^__libc_start_main' ! setl ft=strace # VSE JCL elseif line1 =~ '^\* $$ JOB\>' || line1 =~ '^// *JOB\>' ! setl ft=vsejcl # TAK and SINDA elseif line4 =~ 'K & K Associates' || line2 =~ 'TAK 2000' ! setl ft=takout elseif line3 =~ 'S Y S T E M S I M P R O V E D ' ! setl ft=sindaout elseif getline(6) =~ 'Run Date: ' ! setl ft=takcmp elseif getline(9) =~ 'Node File 1' ! setl ft=sindacmp # DNS zone files elseif line1 .. line2 .. line3 .. line4 =~ '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA' ! setl ft=bindzone # BAAN elseif line1 =~ '|\*\{1,80}' && line2 =~ 'VRC ' || line2 =~ '|\*\{1,80}' && line3 =~ 'VRC ' ! setl ft=baan # Valgrind elseif line1 =~ '^==\d\+== valgrind' || line3 =~ '^==\d\+== Using valgrind' ! setl ft=valgrind # Go docs elseif line1 =~ '^PACKAGE DOCUMENTATION$' ! setl ft=godoc # Renderman Interface Bytestream elseif line1 =~ '^##RenderMan' ! setl ft=rib # Scheme scripts elseif line1 =~ 'exec\s\+\S*scheme' || line2 =~ 'exec\s\+\S*scheme' ! setl ft=scheme # Git output elseif line1 =~ '^\(commit\|tree\|object\) \x\{40,\}\>\|^tag \S\+$' ! setl ft=git # Gprof (gnu profiler) elseif line1 == 'Flat profile:' && line2 == '' && line3 =~ '^Each sample counts as .* seconds.$' ! setl ft=gprof # Erlang terms # (See also: http://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html#Choosing-Modes) elseif line1 =~? '-\*-.*erlang.*-\*-' ! setl ft=erlang # YAML elseif line1 =~ '^%YAML' ! setl ft=yaml # MikroTik RouterOS script elseif line1 =~ '^#.*by RouterOS.*$' ! setl ft=routeros # Sed scripts # #ncomment is allowed but most likely a false positive so require a space # before any trailing comment text elseif line1 =~ '^#n\%($\|\s\)' ! setl ft=sed else var lnum = 1 *************** *** 418,424 **** endwhile if getline(lnum) =~ '^Index:\s\+\f\+$' # CVS diff ! set ft=diff # locale input files: Formal Definitions of Cultural Conventions # filename must be like en_US, fr_FR@euro or en_US.UTF-8 --- 418,424 ---- endwhile if getline(lnum) =~ '^Index:\s\+\f\+$' # CVS diff ! setl ft=diff # locale input files: Formal Definitions of Cultural Conventions # filename must be like en_US, fr_FR@euro or en_US.UTF-8 *** ../vim-9.0.1518/src/version.c 2023-05-06 19:19:59.428601312 +0100 --- src/version.c 2023-05-06 21:19:36.492824116 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1519, /**/ -- hundred-and-one symptoms of being an internet addict: 2. You kiss your girlfriend's home page. /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20230506202221.B08D91C1B21%40moolenaar.net.