2014-03-05

Blogger integration with Emacs

This blog post is published using my latest hack: Blogger integration in Emacs.

I can write my post in an emacs buffer, using Muse markup. I then run M-x bl/post, type the title and the post will be automatically published.

I will post the source code to it soon. I need to do some more testing first.

However, there are some problems for anyone wanting to use this. For some inexplicable reason, Google has a manual process where you have to apply to be allowed to use their API to Blogger. It applied at least twice, and it took days before I got any response. I'm not the only one, as the Blogger dev group is full of people asking how they get access to the API.

I will post the source on Github shortly.

2014-01-09

A first example of the GNU APL mode for Emacs

For the longest time, I have been interested in learning APL, but there have been a remarkable lack of free APL implementations that works on Linux. So one GNU APL was released recently I got very interested.

APL is a very interesting language, and one of its recognisable features is that it uses non-ASCII characters. In fact, most functions in the language is a single character which tends to make the programs very compact (and some would say, unreadable).

Once I had downloaded and installed GNU APL, I was a bit disappointed to see that there was no Emacs mode for running the APL interpreter. I found this to be a problem, since the special symbols require a special keymap and Emacs would be perfect for managing the input modes.

There were a few projects that never seems to have been finished, so in practice there was nothing available that I could use. So, I did was every self-proclaimed open source fan would do, I started writing my own Emacs mode specifically for GNU APL.

At this point I have gotten far enough that it's possible to show some of the highlights, so I decided to write this post to show a walkthrough how it works.

When first starting the GNU APL mode by typing M-x gnu-apl, the following is displayed:


The message at the bottom indicates that the native module that handles communication between the Emacs mode and the GNU APL interpreter has been started.


Here, we have assigned some variables and display an array. Then, I also moved the cursor to the rho symbol to show how the Eldoc support displays help about the function on the modeline.

There is also integrated support for more detailed documentation. If you move to a symbol and press C-c s, the help window will open.


The documentation that can be seen above are extracts from the IBM APL2 documentation. I have talked to IBM and received the appropriate license to include this text.

Next, let's take a look at function definitions.


When defining a function, a window will automatically open with the current definition, allowing you to edit the function outside of the interpreter itself. This provides a richer experience compared to the default line-based editor.


When editing APL files, you can simply move the cursor to a function and press C-c C-c to define it in the active interpreter.

Sometimes one might want to view and edit large matrixes. The Emacs mode integrates support for SES, the Emacs spreadsheet, shown in the below screenshot:


In order to use it, simply press C-c v, and type the name of the variable that holds the matrix. A separate SES buffer will be created where the content can be edited. There is currently no support for actually sending the data back to the APL interpreter, but that's the next feature that will be implemented.

It will also be possible to save the array as an APL function to a normal source file. The resulting code will be a function definition that when run returns the array data.