Re: [vim/vim] filetype: AL (Business Central) files are detected as perl (PR #20975)

Torben Leth (Vim Github Repository) <[email protected]> Sat, 08 Aug 2026 05:18:26 -0700
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/pull/20975/[email protected]>
SShadowS left a comment (vim/vim#20975)

A correction to the measurement in the description, in Vim's favour.

While implementing the same disambiguation for cloc I found that a UTF-8 BOM defeats an anchored pattern, because a BOM is not whitespace. AL tooling commonly writes files with one: of the 15358 Business Central files I measured, 1788 carry a BOM.

Vim is not affected. Vim strips the BOM into 'bomb' when reading, so getline() never sees it, and I confirmed that a BOM-prefixed AL file is detected correctly with this patch applied.

What was wrong is the number and the explanation. I produced the 99.6% figure with a Python reimplementation of the pattern that did not strip the BOM, so it understated what dist#ft#FTal() actually does, and the claim that the missed files are all commented out held for only two of them. Corrected:

| Corpus | Files | Correctly detected |
| --- | --- | --- |
| Business Central application sources | 15358 | 15356 (99.987%) |
| Perl AutoLoader files from Git for Windows | 75 | 75 (100%) |

The two files not detected do contain no object declaration at all, their entire contents being commented out behind `#if not CLEAN26`.

No change to the patch is needed; I did not want the description left overstating the failure rate.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20975#issuecomment-5226065565
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/pull/20975/[email protected]>

-- 
-- 
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/vim/vim/pull/20975/c5226065565%40github.com.