Looking for a Fancier Mode Line?

Here’s a Stack Exchange post that tells you how.

Posted in General | Tagged | 1 Comment

SBCL 1.2.7 Is Out

It’s the beginning of the month so there’s a new version of Steel Bank Common Lisp available at the usual place. The nicest improvement, I think, is that you can now restart frames in the debugger. As usual, there are bug fixes and a few enhancements. See the NEWS file for details.

Also as usual, I want to recommend SBCL to anyone who is or wants to be Lisp programmer. It’s an excellent system that includes a optimizing compiler. Combine it with Emacs/Slime and you have a world-class Lisp environment.

Posted in Programming | Tagged , | Leave a comment

Welcome to Emacs Development

Back when Emacs moved from Bazzar to git, Lars Ingebrigtsen wrote a short introduction to Emacs development. I meant to write about it but lost track of the post. Happily, I’ve found it again and am posting about it to encourage any hackers with a few spare cycles to take part.

It turns out that the Emacs bug tracker has a wish list so you can jump right in enhancing some existing feature. Ingebrigtsen’s post tells you how to get the Emacs repository, compile Emacs, and access the wish list. You can, of course, also tackle some of the bugs if you’d rather.

The worst part is executing the FSF copyright transfer. It’s much fussier than it should be but not really hard. You just email in a form, electronically sign the contract that you get in return, and email it back. You can also do everything by snail mail if you’d rather. Do it right now, though, because there’s lots of lag time and when you have a patch ready to go it’s very frustrating to be sitting around waiting for the FSF to do their thing.

Posted in Programming | Tagged | Leave a comment

Finite State Machine Parsers

Back when I was programming network code in C, one of my favorite strategies was to to implement protocol processing as a finite state machine. I found the design was always easier to understand and modify, often by simply changing an entry in the state table. I found I could often use it to simplify non-networking code too.

Robert David Graham and Peter C. Johnson have a very nice research report on Finite State Machine Parsing for Internet Protocols: Faster Than You Think. They claim that with a little hand tuning that takes the instruction pipeline and L1 cache into account, they can produce FSM parsers that out perform alternative methods. The paper doesn’t show more than a few tidbits of code but they do describe their general approach in detail.

I really enjoyed reading the paper and if you like getting deep into backend coding, you probably will too. They even talk about the Aho-Corasick algorithm1, one of my favorites.

As I said, a nice paper and well worth a read. If you don’t know how to use FSMs in your programming, it’s worth taking an hour or two to investigate the technique. It will pay you tremendous dividends every time you can use it.

Footnotes:

1

Aho-Corasick is the algorithm behind fgrep that searches text for several strings at the same time.

Posted in Programming | Tagged | Leave a comment

Attack on the Scientific Method

I just read a horrifying article in Nature. The article, Scientific method: Defend the integrity of physics, recounts an effort among some theoretical physicists to redefine the scientific method so that it no longer requires experimental verification or even that a theory needs to be testable in principle.

The issue is that much of string theory, an entirely theoretical construct, is not testable, even in principle. It has been widely criticized on those grounds. The string theorists are now arguing that it should be enough that a theory be “elegant” and that philosophical and probabilistic arguments should suffice.

What could go wrong? Even a meager imagination can dream up plenty of ways that such a move could end in disaster. An easy example: an elegant, untested, and untestable theory predicts that global warming is (or is not) a threat and we take an action (exploding the world economy or ignoring the threat) based on that theory that turns out to be wrong1. Would you trust a politician or vested interests with such a theory. Experimental verification is required precisely because it gives us confidence that a given theory is true.

Whatever you think about logical positivism, it seems to me that it’s correct in its tenet that ideas or theories that can’t be verified or falsified, at least in principle, are meaningless. If I announced to the world that magical beings inhabit our world but that you can never prove their existence or nonexistence, I’d be widely ridiculed as delusional. I might even come up with some mathematics that’s consistent with the existence of such beings. I’d still be ridiculed.

To me, the issue is clear. If you tell me that your theory isn’t testable, I’ll tell you it’s not science.

Footnotes:

1

Save your stamps. This is an entirely hypothetical example and says nothing about whether or not global warming is a threat.

Posted in General | Tagged | Leave a comment

Multiple Info Buffers

Marcin Borkowski (mbork), who’s an occasional commenter here on Irreal, has an interesting post on his info workflow. He likes to have multiple info buffers open at the same time. That may seem a little odd but as Borkowski explains, he is often working on something in Org mode, say, and needs to check something in the Elisp manual.

It is possible, of course—it’s Emacs, to have multiple info buffers but it’s a bit clumsy. Borkowski wanted to be able to pop up an info buffer immediately whenever he needed it. To do that, he wrote a bit of Elisp to open an additional info buffer (or switch to an existing one) for any info manual. Then he wrote some additional code to call his function for his most often used manuals and bound them to quick key sequences.

A nice solution and another great example of how Emacs makes it easy to adjust it to accommodate your workflow. Head on over and take a look at his code. It may be something that you can use too.

Posted in General | Tagged | 2 Comments

Using Emacs to Run a Course

Via Sacha I found this really interesting post by John Kitchin, whose work Irreal has mentioned many times. In this post, Kitchin writes about how he used Emacs to run a graduate course in Chemical Engineering. Emacs was used to handle everything in the course.

When I say “everything,” I mean everything. As Kitchin says

Every lecture was given from Emacs, every assignment completed in Emacs, turned in from Emacs, graded in Emacs, returned in Emacs.

Kitchin provided each student with a custom Emacs environment that included all the tools he uses for interfacing with Python and for making engineering calculations. In addition, he included a package he calls techela that interfaces with git and handles student assignment submission, quiz and exam taking, retrieval of grades, and other similar chores.

Course administration generally takes a significant amount of a professor’s time. Kitchin’s set up eliminates much of the busy work. Read the post to get an idea of how pervasive Emacs was in the course. As usual, Kitchin exploits Emacs in novel ways that makes his work much easier.

Posted in General | Tagged | Leave a comment

Happy New Year

Have a Happy New Year and be careful out there.

Posted in General | Leave a comment

Safely Loading Your Emacs Configuration

Over at the Emacs Reddit, tending asks how to fall back to a known good Emacs configuration when initialization gets an error. His complaint is that if there’s an error early in his .emacs file, the initialization is aborted and he’s dumped into a default Emacs that doesn’t have his usual environment. We’ve all been there.

Last time I looked, no one had a solution for falling back to a known good configuration but Renan Ranelli pointed to his solution for the problem. Ranelli’s approach is to divide his configuration into several files—as many Emacs users do—and then have a small “bootloader” that loads each file but within a condition-case that captures any errors and records them. The rest of the files (assuming no further errors) are loaded normally. At the end of the loading, any errors are reported but most of his environment is available.

It’s a very nice solution and, if you already have your configuration divided into separate files, very easy to implement. Take a look at his init-bootstrap.el file. You may find you want to do something similar. You could even use the same idea to implement the solution tending was seeking.

Posted in General | Tagged | Leave a comment

Using AUCTeX

Piotr Kaźmierczak has a nice post on why Emacs is the ultimate LaTeX editor1. The idea is that adding AUCTeX to the greatest editor in the world gives you an incredibly powerful LaTeX environment.

Kaźmierczak is a Mathematician so his writings are of exactly the type that TeX/LaTeX were designed for. He gives some examples from one of his papers showing how it’s possible to preview the finished product within an Emacs buffer while still being able to see the markup. This is, as he says, very useful.

He also mentions using flymake with AUCTeX to have Emacs check your LaTeX syntax on the fly, and RefTex mode to manage your references and generate a table of contents to help you navigate through the document. He shows his configuration for using these utilities if you’re interested in setting up a similar environment.

These days, as I’ve said before, I use Org mode for almost all my writing. The nice thing is that Org is easier to use but you can embed LaTeX commands within your document so you still have almost all of the LaTeX functionality available. If I were to write a longer paper with a lot of mathematical content, I’d probably fire up AUCTeX. Kaźmierczak’s post makes me want to do that just for fun.

It’s a great post and if you have any interest in writing in LaTeX, you should give it a read.

Footnotes:

1

The post is from 2010, but Kaźmierczak has added updates occasionally so it’s pretty much up to date.

Posted in General | Tagged , | 2 Comments