Coming in Emacs 25: Dynamic Modules

I like Emacs Lisp and am always adding little bits of Elisp to my init.el that improves my workflow or enhances Emacs in one way or another. Mostly, I can make Elisp do whatever I need it to do but sometimes the bindings just aren’t there and I have to invoke a shell. Starting with Emacs 25, all that is going to change.

Emacs 25 supports the notion of dynamic modules. These modules are natively compiled pieces of code that can be called directly from Emacs and that can access the Emacs environment. It doesn’t take a lot of thought to see the opportunities this offers.

Aurélien Aptel has an excellent post that describes the module system and offers a simple example to so you can see how it works. Modules are, as Aptel notes, like plugins for other software. There’s a bit of busywork to register the module and access the Emacs environment but then it’s just normal C code except when you’re interacting with the environment. It sounds harder than it is: see Aptel’s example.

This facility isn’t something you’re going to be using everyday but when you need a capability that can’t be implemented with Elisp directly, modules are just what you need. Tale a look at Aptel’s post to get a feel for what’s involved and how they work.

UPDATE: Emacs 24 → Emacs 25

Posted in General | Tagged | 2 Comments

The Walking Dead

Who knew these clowns were still alive? Maybe, as The Register suggests, they really aren’t. A better question is why they aren’t the subject of a RICO investigation.

Posted in General | Tagged | Leave a comment

SBCL 1.3.4

I just installed the latest version of the wonderful Steel Bank Common Lisp system. Version 1.3.4 is mostly a bug fix but there are a couple of enhancements and an optimization. You can read the details on the NEWS page.

The SBCL development team generally releases a new version every month so the system is well maintained and up to date. I say it every time but it’s still true: if you’re looking for a really excellent, free (as in beer and freedom) Common Lisp system, it’s hard to do better than SBCL.

Posted in General | Tagged , | Leave a comment

Some Calc Features

I haven’t written about Emacs Calc for a while but I find myself using it all the time. It’s one of the lesser known secrets of Emacs and that’s too bad. You can use it as a quick calculator in the minibuffer or you can leverage its considerable advanced features which come close to rivaling those of dedicated systems like Macsyma and Mathematica.

Florian Adamsky has a nice post that highlights a couple of Calc’s functionalities. He demonstrates Calc’s ability to work with numbers in different bases and perform not just arithmetical operations but logical ones as well. He also mentions the extensible units systems that allows you to define and work with your own units. Very handy for problems in unusual domains.

As Adamsky says, he’s mostly interested in demonstrating the factors that are of use to his programming activities but Calc is much more than a programmers’ calculator. If you haven’t explored it, you really should give it a look. It probably can’t replace Mathematica but it can allow you to solve all sorts of mathematical problems—including symbolic ones—without leaving Emacs. And not leaving Emacs is, of course, one of our major goals1.

UPDATE: Added missing link to Adamsky’s post

Footnotes:

1

Only slightly tongue-in-cheek.

Posted in General | Tagged , | 3 Comments

ob-hy.el

Just a quickie to report that John Kitchin is on a tear with Hy. Today he’s posting about his development of ob-hy.el to further integrate Hy into Org mode. It’s pretty nice. One day in and he can already execute Hy from Org code blocks.

Posted in General | Tagged , , | Leave a comment

Kitchin: Day Two with Hy

Yesterday, I wrote about John Kitchin’s post on Hy, a Lisp dialect that essentially compiles to Python allowing you to write in Lisp while still having access to the Python RTL. Kitchin has published a new post describing his second day with Hy.

You can feel his excitement as he writes about experimenting with the language and seeing what it can do. As in the first post, he gives several examples including a first attempt at an Elisp macro that allows you to embed Hy in Elisp. As Kitchin notes, the language is still new and evolving so it’s apt to get better and better over time.

In the mean time, there are already resources for it. Emacs, of course, has a major mode for it that provides syntax highlighting and a REPL and abo-abo has added support for it to his lispy package. There’s also a survival guide and, of course, it’s on twitter.

I don’t really have a need for the Python RTL but I am, nevertheless, really excited to see how this all works out. I used to use Python a lot until I moved on to Lisp. Perhaps Hy will entice me to return to Python for at least some tasks.

Once again, thanks to Karl Voit for the pointer.

Posted in General | Tagged , , | Leave a comment

What if Elisp and Python Had a Child?

John Kitchin, as Irreal has covered many times, is doing a lot of excellent work with Org mode and Emacs. Most of his scientific computation is done in Python, a language he’s been using for 15 years and is very comfortable with. He’s managed to integrate Python and Org mode by using Babel code blocks.

He discovered, though, that it’s a lot more fun to program in Lisp than in Python. That’s something that many of us have discovered so I’m entirely sympathetic to is desire to do his scientific work in Lisp. The problem is that Python has really great support for scientific calculations that isn’t generally available in Lisp environments. What’s really needed, he says, is a way of accessing the Python library from Lisp. Happily, there is a way of doing this with Hy, a Lisp dialect that compiles to a Python abstract syntax tree that can executed by Python.

Kitchin tries a few simple experiments in his post and discovers that it’s amazingly simple to write in Lisp and still have all the numerical goodness of Python. Take a look at his post to see easy and natural it is. If, like Kitchin, you have a large investment in Python knowledge, need the scientific libraries that Python provides, and would rather be writing in Lisp be sure to check out his post and then head over to the Hy site. It’s pretty easy to install and get started with Hy so you can try it out with little effort.

Hat tip to Karl Voit for pointing me to Kitchin’s post.

Posted in General | Tagged , , , | 2 Comments

Moving to the Next/Previous Link in Org Mode

Here’s something I didn’t know. You probably won’t need this often but it’s a useful thing to add to your toolbox.

Posted in General | Tagged , | Leave a comment

Email Strategy

As Scooby-Doo would say, RUH?

Posted in General | Tagged | Leave a comment

Molecule Representations in Org Mode

This will be of no use to most of us but it’s so darn neat I had to write about. John Kitchin, who’s a genius a finding ways to move nearly everything into Org mode, has a blog post on drawing molecule representations in Org. Kitchin, of course, is a chemical engineer so this is something very useful for him, especially since his group uses Org to write most of their papers.

Sure, you can argue that all the real work is being done by SMILES and Open Babel but what’s nice about this approach is that it brings everything into Org, which has important reproducible research and organizational consequences. In a subsequent post, Kitchin explores another method of doing the same thing.

As I say, most of us won’t have a use for this but it is neat and it does show how flexible Org is and that it can meet much more of your publishing needs than you might imagine.

Posted in General | Tagged , | Leave a comment