[vim/vim] runtime: add PicoLisp filetype (PR #14476)

38 views
Skip to first unread message

Nat

unread,
Apr 10, 2024, 4:36:12 AM4/10/24
to vim/vim, Subscribed

This PR adds support for the PicoLisp programming language. PicoLisp exclusively uses the *.l filename extension, which is currently also used by Lex among several other extensions, so I have removed *.l from the Lex filename extensions and transferred it to PicoLisp.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/14476

Commit Summary

  • a9f88b7 runtime: add PicoLisp filetype

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476@github.com>

dkearns

unread,
Apr 10, 2024, 6:09:00 AM4/10/24
to vim/vim, Subscribed

@dkearns requested changes on this pull request.


In runtime/filetype.vim:

> @@ -1199,7 +1199,7 @@ au BufRead,BufNewFile *.ldg,*.ledger,*.journal			setf ledger
 au BufNewFile,BufRead *.less			setf less
 
 " Lex
-au BufNewFile,BufRead *.lex,*.l,*.lxx,*.l++	setf lex
+au BufNewFile,BufRead *.lex,*.lxx,*.l++		setf lex

You can't just steal the *.l extension for the new filetype, unless you're willing to fight off a horde of pitch-fork wielding Lex users.

You need to add a function to https://github.com/vim/vim/tree/master/runtime/autoload/dist/ft.vim that can determine the file type based on content heuristics and call that from the autocmd in filetype.vim.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/review/1991282480@github.com>

Nat

unread,
Apr 10, 2024, 10:42:59 AM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 64034de runtime: add PicoLisp filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17937494619@github.com>

zeertzjq

unread,
Apr 10, 2024, 10:46:47 AM4/10/24
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In runtime/autoload/dist/ft.vim:

> +# determine if a *.tf file is tf mud client or terraform
+export def fttf()

The function name should not be changed

⬇️ Suggested change
-# determine if a *.tf file is tf mud client or terraform
-export def fttf()
+# Determine if a *.tf file is TF mud client or terraform
+export def FTtf()


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/review/1991915378@github.com>

Nat

unread,
Apr 10, 2024, 10:48:02 AM4/10/24
to vim/vim, Subscribed

@nat-418 commented on this pull request.


In runtime/filetype.vim:

> @@ -1199,7 +1199,7 @@ au BufRead,BufNewFile *.ldg,*.ledger,*.journal			setf ledger
 au BufNewFile,BufRead *.less			setf less
 
 " Lex
-au BufNewFile,BufRead *.lex,*.l,*.lxx,*.l++	setf lex
+au BufNewFile,BufRead *.lex,*.lxx,*.l++		setf lex

I confess that I have never written vim9script before and I have forgotten what vimscript I once did know, so if the function I have added seems poor to you I apologize in advance. Essentially, I am trying to express the notion that, as a Lisp, a PicoLisp file should always begin with a leading ( somewhere (excluding shebangs, etc.).


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/review/1991918662@github.com>

zeertzjq

unread,
Apr 10, 2024, 10:49:02 AM4/10/24
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In runtime/autoload/dist/ft.vim:

> @@ -1191,6 +1191,20 @@ export def FTdat()
   endif
 enddef
 
+# Determne if a *.l file is Lex or PicoLisp
+export def FTl()
+  var numberoflines = line('$')
+  for i in range(1, numberoflines)
+    var currentline = trim(getline(i))
+    var firstcharacter = currentline[0]
+    if firstcharacter !=? "("
⬇️ Suggested change
-    if firstcharacter !=? "("
+    if firstcharacter ==? "("


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/review/1991921042@github.com>

Nat

unread,
Apr 10, 2024, 10:54:07 AM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 5bf7786 runtime: add PicoLisp filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17937689209@github.com>

Nat

unread,
Apr 10, 2024, 10:55:03 AM4/10/24
to vim/vim, Subscribed

@nat-418 commented on this pull request.


In runtime/autoload/dist/ft.vim:

> +# determine if a *.tf file is tf mud client or terraform
+export def fttf()

this was a mistake on my part, and I offer my apologies


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/review/1991942739@github.com>

Nat

unread,
Apr 10, 2024, 11:33:44 AM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 67320b1 runtime: add PicoLisp filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17938371702@github.com>

dkearns

unread,
Apr 10, 2024, 12:15:12 PM4/10/24
to vim/vim, Subscribed

@dkearns requested changes on this pull request.


In runtime/autoload/dist/ft.vim:

> @@ -1191,6 +1191,28 @@ export def FTdat()
   endif
 enddef
 
+# Determne if a *.l file is Lex or PicoLisp
⬇️ Suggested change
-# Determne if a *.l file is Lex or PicoLisp
+# Determine if a *.l file is Lex or PicoLisp

In runtime/autoload/dist/ft.vim:

> @@ -1191,6 +1191,28 @@ export def FTdat()
   endif
 enddef
 
+# Determne if a *.l file is Lex or PicoLisp
+export def FTl()
+  " Default to Lex
+  set ft=lex
⬇️ Suggested change
-  set ft=lex
+  setf lex

All set ft= lines need to use setf.


In runtime/autoload/dist/ft.vim:

> @@ -1191,6 +1191,28 @@ export def FTdat()
   endif
 enddef
 
+# Determne if a *.l file is Lex or PicoLisp
+export def FTl()

There needs to be an option to override this behaviour with a global variable g:filetype_l like the FTlsl example.

This also needs to be documented at :help filetype-overrule.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/review/1992141861@github.com>

Nat

unread,
Apr 10, 2024, 1:22:12 PM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17939985228@github.com>

Nat

unread,
Apr 10, 2024, 1:22:24 PM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17939989170@github.com>

Nat

unread,
Apr 10, 2024, 1:59:02 PM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • cc7af8c fix(runtime): add docs and test for *.l filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17940475361@github.com>

Nat

unread,
Apr 10, 2024, 2:00:38 PM4/10/24
to vim/vim, Subscribed

Thanks to @dkearns and @zeertzjq for guiding me through this PR.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/c2048155046@github.com>

Christian Brabandt

unread,
Apr 10, 2024, 4:22:14 PM4/10/24
to vim/vim, Subscribed

thanks, but tests still seem to fail.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/c2048371665@github.com>

Nat

unread,
Apr 10, 2024, 5:42:46 PM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 0f86428 fix(runtime): try to correctly detect Lex


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17943223080@github.com>

Nat

unread,
Apr 10, 2024, 5:45:03 PM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 702a5eb fix(runtime): vim9script comment


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17943246079@github.com>

Nat

unread,
Apr 10, 2024, 6:18:41 PM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • c7ce39d fix(runtime): add docs and test for *.l filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17943584737@github.com>

Nat

unread,
Apr 10, 2024, 6:31:53 PM4/10/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 1ceb2df fix(runtime): add docs and test for *.l filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17943734410@github.com>

Christian Brabandt

unread,
Apr 11, 2024, 3:28:52 PM4/11/24
to vim/vim, Subscribed

test still fails :/


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/c2050374573@github.com>

Nat

unread,
Apr 13, 2024, 4:04:03 PM4/13/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 8bf1813 fix(runtime): add docs and test for *.l filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17983960319@github.com>

Nat

unread,
Apr 13, 2024, 4:14:51 PM4/13/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • e177f08 fix(runtime): add docs and test for *.l filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17984021537@github.com>

Nat

unread,
Apr 13, 2024, 4:34:53 PM4/13/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 40c0458 fix(runtime): add docs and test for *.l filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17984121962@github.com>

Nat

unread,
Apr 13, 2024, 6:16:26 PM4/13/24
to vim/vim, Push

@nat-418 pushed 1 commit.

  • 9e77dd8 fix(runtime): add docs and test for *.l filetype


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17984591019@github.com>

zeertzjq

unread,
Apr 13, 2024, 7:17:38 PM4/13/24
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/testdir/test_filetype.vim:

> @@ -528,6 +528,7 @@ def s:GetFilenameChecks(): dict<list<string>>
     pf: ['pf.conf'],
     pfmain: ['main.cf', 'main.cf.proto'],
     php: ['file.php', 'file.php9', 'file.phtml', 'file.ctp', 'file.phpt', 'file.theme'],
+    picolisp: ['file.l'],
⬇️ Suggested change
-    picolisp: ['file.l'],


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/review/1999373322@github.com>

Nat

unread,
Apr 14, 2024, 1:22:59 AM4/14/24
to vim/vim, Push

@nat-418 pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/push/17986376332@github.com>

zeertzjq

unread,
Apr 14, 2024, 3:19:30 AM4/14/24
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In runtime/autoload/dist/ft.vim:

> @@ -1191,6 +1191,32 @@ export def FTdat()
   endif
 enddef
 
+# Determine if a *.l file is Lex or PicoLisp (default to Lex)
+export def FTl()
+  if exists("g:filetype_l")
+    exe "setf " .. g:filetype_l
+    return
+  endif
+  for i in range(1, line("$"))

Many filetype detection functions have a limit to the number of lines to check, like using range(1, min([line("$"), 100]))


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/review/1999491893@github.com>

Christian Brabandt

unread,
Jun 13, 2026, 4:16:51 PM (10 hours ago) Jun 13
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#14476)

this has stalled, so closing


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14476/c4699669214@github.com>

Reply all
Reply to author
Forward
0 new messages