A new Perl 6 major mode for emacs! (In Progress)

I’ve finally gotten fed up with cperl-mode, because it has now decided to throw lisp errors upon typing things like : or }, anything that would make use of its electric feature (which I couldn’t find how to turn off fast enough), so now I decided to take an earnest effort in creating my own perl6 major mode.


Right now this mode highlights "" and '' strings (because emacs provides string and comment highlighting for you; I have yet to set up comments), as well as sigilled variables with identifier names and also $_, $!, and $/. There’s also an indentation code that works well, but the rules that govern it will certainly need refinement over time as more specialized rules are discovered 🙂 .

If you use emacs, I invite you to try it out. The easiest way to use it is to open it in emacs, type M-x eval-buffer, and then open a Perl 6 file and type M-x p6-mode . The only part that will likely be bug-report-worthy* is going to be when the indentation code doesn’t work right. Issues with highlighting are not worthwhile to report until there’s quite a bit of highlighting support 🙂 .

I hope that in the coming weeks/months this will turn into a fully-functional Perl 6 major mode. It will also, after full Standard Perl 6 support is done, be extensible due to the highly malleable nature of Perl 6 parsing. (see the repo’s README for more on this)

Have the appropriate amount of fun!

*Lisp errors that throw you into a debugger and turn all of your modelines from saying (Fundamental) to [(Fundamental)] are of course another problem to report. If that happens, follow these steps (or else that [(Fundamental)] thing, called recursive edit mode, will possibly never go away until you restart emacs):

  1. Select the entire error (with your mouse or C-x h)
  2. Copy it (M-w)
  3. Exit the debugger (q)
  4. Paste in another buffer before you lose the error, *scratch* is a good choice (C-x b *scratch* C-y)
  5. Report the issue to https://github.com/lue/p6mode/issues, preferably with the error message you just copy-pasted 🙂 .
This entry was posted in Progress Happened and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s