Sacha Chats with Mickey

Sacha Chua has her latest Emacs chat up. This time it’s with Mickey Petersen proprietor of the excellent Mastering Emacs. If you follow the Emacs scene at all, you will be familiar with Mickey and his definitive articles on the ins and outs of Emacs.

Mickey came to Emacs pretty much because he was told all the cool kids use Vim. In the intervening 10 years he’s worked to master Emacs and share his knowledge with the rest of us through his blog. Watching him use Emacs you can see that mastery in action. He navigates through files so quickly and easily that it’s hard to follow the action.

One of the things that impressed and inspired me was that he tends to think in term of language constructs rather than characters. Thus, for example, he navigates by and manipulates s-expressions. That’s an attitude that I want to cultivate; it can’t help but increase my editing speed and efficiency.

The chat is about 53 and a half minutes so plan accordingly. As with all of Chua’s chats, you’re sure to learn a few things. For example, I learned the efficient way to backwards kill an s-expression.

Update: Sacha has a transcript of the chat up.

Posted in General | Tagged | Leave a comment

Transposing Words

Howard Abrams has a nice video on transposing words in Emacs. You might think that there’s not much to say about the subject: just type 【Meta+t】 and you’re done. Of course there’s also the fact that you can use it to “pull” a word towards the end of the line by repeated invocation of the command or by using a prefix number but that’s also well known.

Abrams explores an interesting edge case. What if you’re at the end of the line? He’s got an actual use for that. Suppose you’re typing along and realize you forgot a word

The brown fox

Rather than backing up and inserting the missing word, you can just type it at the end

The brown fox quick

and then type 【Meta+t Meta+t】 and quick gets inserted in the proper place.

That’s a nice trick that takes advantage of a side effect of transpose-words and you can use it as is. But Abrams shows how to advise transpose-words so that it handles this case with a single invocation. That means you just type 【Meta+t】 as usual and Emacs does the right thing.

The video is only 8 minutes so you can watch it whenever you have a few minutes. Very nice. Even if you don’t add the advise, it’s worth knowing the trick.

Posted in General | Tagged | 1 Comment

SBCL 1.2.3

The latest version of Steel Bank Common Lisp, 1.2.3, is available at the usual place. As always, it built without problem and successfully ran the test suite. ASDF has been upgraded to 3.1.3 and there are a couple more enhancements and some bug fixes as well. Check the NEWS page for details.

As Christophe Rhodes remarked, this month’s release is less exciting (read controversial) than last month’s. Regardless, SBCL is an excellent Lisp environment that gets better and better with each release.

Update: months → month’s

Posted in Programming | Tagged , | Leave a comment

Temporary Syntax Tables

Xah Lee has a nice post on how to temporarily modify a syntax table. It’s not something you want to do everyday, of course, but the example Lee gives is a real-world case.

It turns out that it’s pretty easy. Just use the with-syntax-table macro and you can change the syntax table in a way useful for the rest of the code in the macro’s body. When control exits the macro expansion, the old syntax table is restored. You can also use the macro to temporarily switch to a different syntax table. If the foregoing seems opaque, the example in Lee’s post will clear things up.

I didn’t know about the with-syntax-table macro so this post is my way of writing it down so I won’t forget. I’m sure I won’t need it often but when I do, it’s just the thing.

Posted in General | Tagged | Leave a comment

Another Reason Closed Source is Harmful

Open Source/Free Software includes a number of tribes. There are the FSF true believers, epitomized by RMS, who hold that software should be free on philosophical/ideological grounds. Even if one could adduce facts showing that Free Software was less optimal than closed source, these folks would be unmoved; it’s a matter of morality.

Then there are folks like Cory Doctorow and ESR who still insist on using strictly Open Software but do so on (mostly) pragmatic grounds. Members of this tribe seek to avoid lock-in or loss of data. It’s easy to see why someone like Doctorow would fear having his data locked in some proprietary format that could become unsupported at the whim of some software company.

There’s also the tribe that is willing to use a proprietary program or OS, when necessary, as long as it doesn’t involve their data. As a Mac user, I fall into this group. Even though I prefer open source, I’m perfectly happy to enjoy the benefits that OS X brings me but I would never use Word, or Pages (the Mac answer to Word), or Numbers (the Mac spreadsheet). Instead all my data is held as plain text (even, thanks to Org Mode, spreadsheet type data). If OS X were to die tomorrow, my data would be just as useful and accessible on Linux or even Windows.

The key here is that you must never commit any data you care about to anything but plain text. If someone or something requires, say, word documents, you write and maintain it in Org- or Markdown-mode and export it to word as Mark Szepieniec and Christophe-Marie Duquesne outlined for résumés. Most of us know and practice all this no matter which tribe we adhere to.

It turns out, though, that it’s a bit more complicated. Jonathan Zdziarski has an interesting post on digital forensics and the threat that closed source poses to it. Most law enforcement agencies use closed source programs to extract data from phones or computers and for other forensic tasks. One problem is that the user has no way of knowing what the programs are doing or how they’re massaging the data. This can present legal problems when, for example, the defense insists on auditing the program that produced the data. In the case of breathalyzers, which are also mostly closed source, this has already resulted in DUI dismissals.

It gets worse though. Zdziarski reports that the results these forensic programs produce are often flat out wrong—even made up in some cases. That’s an obvious problem no matter which side of law enforcement you’re on. If you’re the defendant, you might get wrongly convicted. If you’re with law enforcement, guilty parties may be erroneously cleared.

Closed source isn’t the only problem that Zdziarski describes but it is a large one. We will certainly see cases involving forensics depending on these programs challenged and dismissed. In the mean time, those of us who support open source get to feel smug. Just don’t find yourself on the wrong end of a digital forensics investigation.

Posted in General | Tagged | Leave a comment

Version Control

Everybody agrees that version control (VC) is the right thing but, sadly, too often it’s ignored anyway. I use version control—Git via Magit—in two ways. First, it’s the primary way that I keep my machines synchronized. I could, of course, use something like Dropbox for this but Git works well for me and I’ve automated the process so I see no reason to change. The point is that synchronization is not something you need version control for.

The real reason for VC is that you have a history of the changes you’ve made and that, as a result, it’s easy to drop back to a previous state if you code (or write) yourself into a box. Eric Raymond has a revealing post neatly demonstrates the virtues of version control. He writes about a “phase-of-the-moon bug” that, despite frequent and comprehensive regression tests, suddenly appeared after a commit. Nothing too strange about that but when he dropped back to the previous commit the regression tests still failed even though they had passed just a few minutes ago.

It turned out that several commits had the mysterious bug but Raymond was able to locate the culprit pretty quickly with Git bisect. Even if you’re not a Git user, you could still perform the bisection process manually although a good deal less conveniently. The real enabling mechanism was VC. Without it, he’d have had a long and frustrating ordeal of trying to locate each change and test if it was the genesis of the problem.

I’ve heard many developers express the opinion that they don’t need VC because they work alone. As Raymond’s story illustrates, VC can save the day even for the lone developer1. Hop on over and read Raymond’s post and see if it doesn’t convince you that you should be using VC whether or not you’re working alone.

Footnotes:

1

The code Raymond was working on, GPSD, is, in fact, a multi-developer project but that doesn’t come into play here. The story takes place while he was working alone and all the code was his.

Posted in Programming | Tagged | 1 Comment

Extending Isearch

Nicolas Petton presents a nice bit of Elisp that extends the isearch functionality. With his code, you can search for the symbol at point or the active region if there is one.

The first of these is easily accomplished using【Ctrl+w】from within isearch but that takes an extra key chord. With Petton’s code you just invoke his isearch-thing function and it searches for the symbol at point unless there is an active region.

If you are a heavy user of isearch and find yourself typing 【Ctrl+s】 and then 【Ctrl+w】 a lot, this may be win for you.

Posted in General | Tagged | 2 Comments

Tramp with Multiple Hops

The Emacs Tramp package is a wonderful thing. With it, you can easily edit files on remote machines in a virtually transparent fashion. Most Emacs users are familiar with Tramp and use it to edit files on machines on the local network or on remote-network machines directly reachable on the Internet. Often times, though, those remote-network machines are not directly reachable.

A typical example occurs when a developer is working from home and needs to access a machine on his work network that is protected by a firewall. Emacs, of course, can also handle this case. The normal way is to set rules for how to reach remote-network hosts in your .emacs or init.el file. The rules are a bit complex but are documented in the Tramp manual. Sometimes, though, you just want a one-off access to some protected host and it’s a pain to temporarily add Tramp configuration rules for it.

Fortunately, David Vázquez has tweeted the answer:

Unless you need to repeatedly access some remote host, this is a much easier method. The tweet tells you just about everything you need to know but you can see the details in the Tramp documentation.

Posted in General | Tagged | 4 Comments

Awesome Emacs

If you’re new to Emacs, after you learn the basics, can navigate around in buffers, and deal with finding and saving files you’ll probably start looking for packages that can help streamline your work flow. ELPA makes installing those packages easy but how do you find the ones that suit you?

One answer is the Awesome Emacs project, a community driven effort to curate a list of Emacs packages that people find particularly useful. Each package on the list has a link to some elementary documentation—usually, but not always, a GitHub README file. A testament to the quality of the list is that almost all the packages I have installed are on it. That gives me confidence that I’ll find the others on the list useful too.

You probably won’t want to install them all because many are for specialized environments such as Erlang development. The packages are listed by category so it’s easy to find packages relevant to your needs. Even if you’re an experienced Emacs user, it’s worthwhile taking a look at the list.

Posted in General | Tagged | 2 Comments

Wisdom

Some wisdom from Bozhidar Batsov

Posted in General | Tagged | 2 Comments