patch 9.2.0237: filetype: ObjectScript routines are not recognized

Commit: 
https://github.com/vim/vim/commit/25f6539645d805295b11253c7bd8632aa20604f4
Author: Hannah Kimura <[email protected]>
Date:   Tue Mar 24 19:58:01 2026 +0000

    patch 9.2.0237: filetype: ObjectScript routines are not recognized
    
    Problem:  filetype: ObjectScript routines are not recognized
    Solution: Add ObjectScript routines detection for .mac, .int, and .inc
              files (Hannah Kimura)
    
    Reference:
    
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GORIENT_ch_intro#GORIENT_intro_routines
    
    closes: #19805
    
    Signed-off-by: Hannah Kimura <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 5b54b1c47..20495866b 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -3,7 +3,7 @@ vim9script
 # Vim functions for file type detection
 #
 # Maintainer:          The Vim Project <https://github.com/vim/vim>
-# Last Change:         2026 Mar 20
+# Last Change:         2026 Mar 24
 # Former Maintainer:   Bram Moolenaar <[email protected]>
 
 # These functions are moved here from runtime/filetype.vim to make startup
@@ -11,6 +11,12 @@ vim9script
 
 var prolog_pattern = '^\s*\(:-\|%\+\(\s\|$\)\|\/\*\)\|\.\s*$'
 
+def IsObjectScriptRoutine(): bool
+  var line1 = getline(1)
+  line1 = substitute(line1, '^\ufeff', '', '')
+  return line1 =~? 
'^\s*routine\>\s\+[%A-Za-z][%A-Za-z0-9_.]*\%(\s*\[\|\s*;\|$\)'
+enddef
+
 export def Check_inp()
   if getline(1) =~ '%%'
     setf tex
@@ -75,6 +81,18 @@ export def FTasm()
   exe "setf " .. fnameescape(b:asmsyntax)
 enddef
 
+export def FTmac()
+  if exists("g:filetype_mac")
+    exe "setf " .. g:filetype_mac
+  else
+    if IsObjectScriptRoutine()
+      setf objectscript_routine
+    else
+      FTasm()
+    endif
+  endif
+enddef
+
 export def FTasmsyntax()
   # see if the file contains any asmsyntax=foo overrides. If so, change
   # b:asmsyntax appropriately
@@ -871,6 +889,10 @@ export def FTinc()
   if exists("g:filetype_inc")
     exe "setf " .. g:filetype_inc
   else
+    if IsObjectScriptRoutine()
+      setf objectscript_routine
+      return
+    endif
     for lnum in range(1, min([line("$"), 20]))
       var line = getline(lnum)
       if line =~? "perlscript"
@@ -940,6 +962,16 @@ export def FTi()
   setf progress
 enddef
 
+export def FTint()
+  if exists("g:filetype_int")
+    exe "setf " .. g:filetype_int
+  elseif IsObjectScriptRoutine()
+    setf objectscript_routine
+  else
+    setf hex
+  endif
+enddef
+
 var ft_pascal_comments = '^\s*\%({\|(\*\|//\)'
 var ft_pascal_keywords = 
'^\s*\%(program\|unit\|library\|uses\|begin\|procedure\|function\|const\|type\|var\)\>'
 
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 8dbe4e68c..6a7fa3b59 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -1,4 +1,4 @@
-*filetype.txt* For Vim version 9.2.  Last change: 2026 Feb 14
+*filetype.txt* For Vim version 9.2.  Last change: 2026 Mar 24
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -161,8 +161,10 @@ variables can be used to overrule the filetype used for 
certain extensions:
                                                |ft-cpp-syntax|
        *.i             g:filetype_i            |ft-progress-syntax|
        *.inc           g:filetype_inc
+       *.int           g:filetype_int
        *.lsl           g:filetype_lsl
        *.m             g:filetype_m            |ft-mathematica-syntax|
+       *.mac           g:filetype_mac
        *[mM]makefile,*.mk,*.mak,[mM]akefile*
                        g:make_flavor           |ft-make-syntax|
        *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index a63efb243..aa36477c1 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:          The Vim Project <https://github.com/vim/vim>
-" Last Change:         2026 Mar 23
+" Last Change:         2026 Mar 24
 " Former Maintainer:   Bram Moolenaar <[email protected]>
 
 " If the filetype can be detected from extension or file name(the final path 
component),
@@ -119,10 +119,13 @@ au BufNewFile,BufRead 
*/boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf
 " *.mc omitted - used by dist#ft#McSetf()
 au BufNewFile,BufRead *.demo,*.dm{1,2,3,t},*.wxm,maxima-init.mac setf maxima
 
+" ObjectScript routine or assembly
+au BufNewFile,BufRead *.mac                    call dist#ft#FTmac()
+
 " Assembly (all kinds)
 " *.lst is not pure assembly, it has two extra columns (address, byte codes)
 " *.[sS], *.[aA] usually Assembly - GNU
-au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst  call dist#ft#FTasm()
+au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.lst        call dist#ft#FTasm()
 
 " BASIC or Visual Basic
 au BufNewFile,BufRead *.bas                    call dist#ft#FTbas()
@@ -572,6 +575,9 @@ au BufNewFile,BufRead *.pro                 call 
dist#ft#ProtoCheck('idlang')
 " Initng
 au BufNewFile,BufRead */etc/initng/*/*.i,*.ii  setf initng
 
+" Intel HEX or ObjectScript routine
+au BufNewFile,BufRead *.int                    call dist#ft#FTint()
+
 " Innovation Data Processing
 au BufNewFile,BufRead upstream.dat

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/vim_dev/E1w589X-004AUL-Ce%40256bit.org.

Raspunde prin e-mail lui