[vim/vim] Distinguish between Forth and Fortran filetypes for *.f files (PR #12251)

40 views
Skip to first unread message

Doug Kearns

unread,
Apr 12, 2023, 6:13:29 AM4/12/23
to vim/vim, Subscribed

Also adds *.4th as a Forth filetype

@jkotlinski, could you please run your eyes over this?


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

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

Commit Summary

  • 93ad6bd Distinguish between Forth and Fortran filetypes for *.f files

File Changes

(5 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/12251@github.com>

codecov[bot]

unread,
Apr 12, 2023, 6:26:09 AM4/12/23
to vim/vim, Subscribed

Codecov Report

Merging #12251 (93ad6bd) into master (b6ebe5a) will increase coverage by 0.38%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master   #12251      +/-   ##
==========================================
+ Coverage   81.94%   82.32%   +0.38%     
==========================================
  Files         164      154      -10     
  Lines      194114   183698   -10416     
  Branches    43832    41405    -2427     
==========================================
- Hits       159060   151225    -7835     
+ Misses      22213    19918    -2295     
+ Partials    12841    12555     -286     
Flag Coverage Δ
huge-clang-none 82.66% <ø> (+0.03%) ⬆️
huge-gcc-none ?
huge-gcc-testgui 51.96% <ø> (+<0.01%) ⬆️
huge-gcc-unittests 0.29% <ø> (-0.01%) ⬇️
linux 82.32% <ø> (-0.07%) ⬇️
mingw-x64-HUGE ?
mingw-x86-HUGE ?
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 133 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


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/12251/c1505035043@github.com>

Johan Kotlinski

unread,
May 7, 2023, 11:21:10 AM5/7/23
to vim/vim, Subscribed

Hey, sorry, I missed the notification. I will have a look.


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/12251/c1537466811@github.com>

Johan Kotlinski

unread,
May 7, 2023, 11:30:06 AM5/7/23
to vim/vim, Subscribed

@jkotlinski commented on this pull request.


In runtime/autoload/dist/ft.vim:

> +  return false
+enddef
+
+# Distinguish between Forth and Fortran
+export def FTf()
+  if exists("g:filetype_f")
+    exe "setf " .. g:filetype_f
+    return
+  endif
+
+  var first_line = getline(nextnonblank(1))
+
+  # SwiftForth block comment, line is usually filled with '-' or '='
+  var header_comment   = first_line =~ '^{\%(\s\|$\)'
+  # SwiftForth OPTIONAL, sometimes appears before the header comment
+  var optional_include = first_line =~ '^OPTIONAL\s'

Could the SwiftForth checks give false positives for F#? If not, I think they would be better moved to the IsForth() function.


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/12251/review/1415927432@github.com>

Doug Kearns

unread,
May 7, 2023, 12:44:53 PM5/7/23
to vim/vim, Subscribed

I don't believe so. I'll push the extra tests into IsForth().

Thanks.


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/12251/c1537489324@github.com>

Doug Kearns

unread,
May 7, 2023, 1:12:10 PM5/7/23
to vim/vim, Push

@dkearns pushed 1 commit.

  • 667483a Distinguish between Forth and Fortran filetypes for *.f files


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

Doug Kearns

unread,
May 9, 2023, 1:42:04 PM5/9/23
to vim/vim, Push

@dkearns pushed 1 commit.

  • 3f9cdf3 Distinguish between Forth and Fortran filetypes for *.f files

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

Johan Kotlinski

unread,
May 21, 2023, 8:44:28 AM5/21/23
to vim/vim, Subscribed

@jkotlinski commented on this pull request.


In runtime/filetype.vim:

>  
 " Reva Forth
 au BufNewFile,BufRead *.frt			setf reva
 
 " Fortran
 if has("fname_case")
-  au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08	 setf fortran
+  au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08	setf fortran

Is it intentional that *.F is still mapped to Fortran only?


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/12251/review/1435531905@github.com>

Doug Kearns

unread,
May 21, 2023, 11:11:01 AM5/21/23
to vim/vim, Subscribed

@dkearns commented on this pull request.


In runtime/filetype.vim:

>  
 " Reva Forth
 au BufNewFile,BufRead *.frt			setf reva
 
 " Fortran
 if has("fname_case")
-  au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08	 setf fortran
+  au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08	setf fortran

It is on the grounds that:

  • Fortran has some conventions for uppercase extensions that makes them meaningful.
  • We don't support uppercase for any other Forth extensions or other filetypes in general.
  • SwiftForth (a notable user of *.f) doesn't implicitly recognise *.F as it does *f.

Is there some history of intentionally capitalised extensions?


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/12251/review/1435554513@github.com>

Johan Kotlinski

unread,
May 21, 2023, 11:31:16 AM5/21/23
to vim/vim, Subscribed

@jkotlinski commented on this pull request.


In runtime/filetype.vim:

>  
 " Reva Forth
 au BufNewFile,BufRead *.frt			setf reva
 
 " Fortran
 if has("fname_case")
-  au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08	 setf fortran
+  au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08	setf fortran

Not that I am aware of. I was simply unaware of Fortran conventions.


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/12251/review/1435557201@github.com>

Yegappan Lakshmanan

unread,
Aug 13, 2023, 2:36:11 PM8/13/23
to vim/vim, Subscribed

Can you please update and rebase this PR to the latest?


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/12251/c1676432426@github.com>

dkearns

unread,
Aug 14, 2023, 9:26:01 AM8/14/23
to vim/vim, Push

@dkearns pushed 1 commit.

  • 9375522 Distinguish between Forth and Fortran filetypes for *.f files

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

dkearns

unread,
Aug 14, 2023, 9:29:32 AM8/14/23
to vim/vim, Subscribed

@yegappan I vaguely recall I was going to tag a test file refactoring (Test_*_file helper) onto this PR but let's leave that for another time.


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/12251/c1677320999@github.com>

Christian Brabandt

unread,
Aug 20, 2023, 2:54:45 PM8/20/23
to vim/vim, Subscribed

Closed #12251 via 19a3bc3.


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/12251/issue_event/10138765084@github.com>

Reply all
Reply to author
Forward
0 new messages