fb-mode, an Emacs mode for FreeBASIC

User projects written in or related to FreeBASIC.
Post Reply
TeeEmCee
Posts: 375
Joined: Jul 22, 2006 0:54
Location: Auckland

fb-mode, an Emacs mode for FreeBASIC

Post by TeeEmCee »

https://github.com/rversteegen/fb-mode

This is a GNU Emacs major mode for FreeBASIC. I'm sure the other FB IDEs are nice, but no Emacs user wants to use a language-specific IDE.

I wrote the original indentation routines about a decade ago and have slowly been building it up into a full mode written from scratch, which I'm finally posting, having finally cleaned it up and fixed bugs. Still needs more work, but it's functional and fairly bug-free (except missing keywords). Updates will be posted here.

I just discovered that there was an existing freebasic-mode posted sometime after I started. I think mine is largely more complete and less buggy, except I don't highlight all the builtin functions/keywords. More comments in the github README.

Features:
  • Syntax highlighting
    • Declared variable names are highlighted, thanks to parsing of variable declarations and sub/function declarations and header lines instead of simplistic keyword highlighting
  • Indentation
    • Full support for lines continued with `_`
    • Amount of indentation is controlled by the `fb-indent-level` variable
  • Commenting/uncommenting, and `fill-paragraph` support for comments
  • C-c C-h to lookup a symbol (default under point) in the manual in a web browser tab (note, doesn't work for many builtins)
  • Adds `compile-mode` support for `fbc` error/warning messages
  • `beginning-of-defun`/`end-of-defun` (C-M-a/C-M-e) support
  • C-M-j to split the current line at point (possibly in middle of a string or comment), adding a _ line continuation and indenting.
See README on Github for more information.
TeeEmCee
Posts: 375
Joined: Jul 22, 2006 0:54
Location: Auckland

Re: fb-mode, an Emacs mode for FreeBASIC

Post by TeeEmCee »

v1.1.0
  • F5 to run `compile`, with suitable default command
  • Looking up keywords in the manual supports operators now (although you need to type punctuation-syntax ones like =>), which fixes most keywords that didn't work
  • Fix error due to missing (require 'cc-mode)
  • Code cleanup, stick closer to conventions (although it still does (eval-when-compile (require 'cl)))
Edit:
v1.1.1:
I've fixed manual lookup for almost all keywords/symbols, including ones like "line input #" and "$dynamic". It still does not disambiguate between same-named keywords though.
Also removed OHRRPGCE-specific stuff to a separate git branch.
maves_moya
Posts: 33
Joined: May 27, 2006 13:54
Location: Maldives

Re: fb-mode, an Emacs mode for FreeBASIC

Post by maves_moya »

I just discovered that there was an existing freebasic-mode posted sometime after I started. I think mine is largely more complete and less buggy, except I don't highlight all the builtin functions/keywords. More comments in the github README.
I just discovered your project too. I'm glad someone else wrote a better major mode for FreeBASIC.

Since I don't plan to work on freebasic-mode anytime soon, I will add a link to your project in my README file,
so anyone who discovers my project can find what they are really looking for.
Post Reply