WDIRED

Mickey over at Mastering Emacs has a nice post on wdired. Dired is an underappreciated part of Emacs but even many who use it don’t realize that you can edit file names, permissions, and owner/group directly in the dired buffer and have the changes reflected in the file system. That ability is already built-in. All you need to do is toggle it on with 【Ctrl+x Ctrl+q】 and make your changes. See Mickey’s post for the details.

If you want to see it in action, watch Magnar Sveen use it to change the names of several files at once using wdired and multiple cursors.

Posted in General | Tagged | Leave a comment

Word

Over at Charlie’s Diary, Charlie Stross has an excellent rant entitled Why Microsoft Word Must Die. I’ve written previously of my own feelings about Word: hatred bordering on the pathological. I consider it the apotheosis of everything that can be wrong in a piece of software. Sadly, its open source clones aren’t any better. They are, as the saying goes, bug compatible with the monstrosity they are emulating.

As great as Charlie’s post is, the comments are what’s really interesting. With a couple of exceptions they mostly amount to a long wail of anguish from pitiful souls condemned by circumstances to use Word. I was surprised to learn that even some scientific researchers are being forced to use it.

Charlie’s concern, of course, is writing fiction. He uses a number of tools for that including Scrivener and Vim. In the end, though, he must convert it to Word for his publishers. Other writers do the same. Vernor Vinge, for example, writes his novels with Emacs. Cory Doctorow uses Vim. No one, it seems, wants to actually do their writing in Word.

I wrote and typeset my two (technical) books using Vim and Groff. These days, all my writing is done with Emacs and Org Mode. Mostly that writing gets exported to HTML, but I’d feel comfortable using Org Mode to write a book. In many ways, it’s a superior solution to using Groff. It means working with LaTex instead of Groff1, which I’m most familiar with, but being able to write in Org Mode would be well worth the effort. My publisher is willing to accept camera ready copy so I would just export to LaTex and run off the PDF.

Even fiction writers can benefit from Org Mode. As of version 8, Org Mode can also export to ODT which should make submitting Word compatible files easier. Writers will choose their own tools for their own reasons but if you want a simple, powerful platform that doesn’t second guess you and can produce output in a variety of formats, it’s hard to beat the Emacs/Org Mode combination.

Footnotes:

1

There is an Org Mode back end that exports to Groff but it uses a different Troff macro package and I’ve never used it.

Posted in General | Tagged | Leave a comment

Magit Stage All Changes

As I’ve mentioned previously, I keep my blog posts—all my work, really—in a git repository. I manage the repositories with magit. If you aren’t a magit user, you’re really missing out and should take a look.

When I publish a post there are usually 3 files affected that need to be committed. In magit-status, I just type 【S】 to stage them all and can then commit. Recently, magit was changed to ask for confirmation before staging all the changed files. While I appreciate the offer, I find it annoying. If I change my mind I can just unstage everything with 【U】 and start over. Others, I’m sure, have different needs but I really don’t want to be asked every time I commit.

Happily, there’s an easy solution. After a little grubbing around in the code, I discovered that there’s a configuration variable to inhibit the confirmation. Just set

(setq magit-stage-all-confirm nil)

and you’re back to the old way. As usual, Emacs makes it easy to have things your way.

The unstage-all command also has a new confirmation. You can get rid of it, if you like, with

(setq magit-unstage-all-confirm nil)

but I didn’t bother with it because I rarely use that command.

Posted in General | Tagged | Leave a comment

Using yasnippet to Reduce Blogging Friction

Every Irreal blog post begins with some header information that tells org2blog the title, category, and tags for the post. These get communicated to WordPress when org2blog exports the post. Those lines look like this:

#+TITLE: Using =yasnippet= to Reduce Blogging Friction
#+CATEGORY: Blogging
#+TAGS: Emacs

There are 862 posts on Irreal at the moment and everyone of them begins with those 3 header lines. That’s a lot of typing, especially with all the capitalization. (Yes, yes, I know all about upcase-word and in fact I type them in lower case and then use 【Meta+b Meta+u】 to capitalize them—it’s still a lot of typing.)

I finally reached the end of the rope and decided that it was past time to install yasnippet so that I could automate that. After some floundering around, I figured out how to get snippets to load with Org Mode and added this snippet:

# -*- mode: snippet -*-
# name: header
# key: bh
# --
#+TITLE: $1
#+CATEGORY: ${2:General}
#+TAGS: $3

Now when I start a post, I begin with bhTab】 and the header skeleton is automatically inserted. I know I’m late to the party on this. Everyone else is already using yasnippet and wondering what took me so long.

All this probably isn’t going to save me huge amounts of time but it does reduce blogging friction a bit so it’s a win. Now that I have yasnippet installed I’ll be looking for other ways to leverage its power.

Posted in Blogging | Tagged | 6 Comments

Air Gaps

Bruce Schneier has an interesting post on setting up an air gap computer. It seems simple: just never connect your computer to the Internet. The problem is a completely isolated computer isn’t much use unless all you want to do is play Reversi or solitaire. To get any useful work done you need to move files onto and off of the computer.

At first glance it’s hard to see how a “normal” person would even need such a thing. But once Schneier became involved in the analysis of the Snowden documents he needed to isolate and protect them. When the need presents itself, you have to consider how best to protect yourself and your data.

Schneier began by buying a new laptop from a big box store and taking it to a friend’s house to download the software he needed. After that he never connected it to the Internet again. Still, there is the need to transfer data to and from the machine. It’s not nearly as easy as it seems.

Follow the link the see how Schneier handles the problem. The real meat in the post is in the comments. Almost everyone said, “Yikes! You’re using Windows? You should be using Linux.” That’s probably good advice but not too helpful. The other comments represent some useful advice. It’s a fairly long post with a lot of comments but it’s definitely worthwhile if you have to do something similar.

Posted in General | Tagged | Leave a comment

The Lavabit Story

The New Yorker has a nice article on the Lavabit back story and current status. It recounts the details of the negotiations between Lavabit and the government. It’s pretty clear that the government was disingenuous about their demands. Armed with a subpoena for the metadata on a single account, they insisted that Lavabit’s owner, Ledar Levison, turn over his SSL keys thereby giving the FBI the ability to monitor all traffic in and out of the site. It’s not clear that the judge, in particular, really understood the issues and what the government was actually demanding.

Levison remarks that even without Snowden as the proximate cause, the government would sooner or later have come after Lavabit because it represented a gap in their intelligence—in their desired ability to monitor all communications. Right now Levison is fighting in the Fourth Circuit Court the government’s right to make such demands. One can only hope he prevails but it’s hard to be sanguine about his chances.

Late Breaking: Lavabit is apparently going to make a Fourth Amendment argument to the court. The idea is that Lavabit’s 40,000 customers who aren’t named Snowden are having their Fourth Amendment right to be secure in their privacy without probable cause and a particularized warrant violated. As the NSA and the FISA courts have demonstrated, the government doesn’t much care about the fourth amendment; they just shout “Look! Terrorists.” and charge ahead. So, again, it’s hard to be hopeful about the outcome.

Posted in General | Tagged | Leave a comment

Terror of the Demo

I’ve given my fair share of demos as I’m sure many of you have. If you’re anything like me, you were lucky if the worst thing you suffered was butterflies in your stomach. But all that was nothing compared to what Andy Grignon suffered and he wasn’t even giving the demo.

It was January 8, 2007, the day of the MacWorld trade show at which the iPhone was going to be announced. Grignon was the senior engineer in charge of the iPhone’s radios and he was about to watch Steve Jobs give his famous announcement and demo. The problem was, the thing wasn’t ready and didn’t work reliably. At all. Jobs had been practicing for 5 days and not one of his run throughs was without problems.

Follow the above link for the story of that demo and how terrifying it was for everyone involved. Apple had bet the company on the iPhone and Jobs was going to use what amounted to a kludged up prototype for the announcement. Practically every aspect of the phone had problems. For example, the memory management software wasn’t finished so the phone tended to quickly run out of memory and freeze. To deal with that, Jobs had multiple phones on the table and switched off after a few tasks so the phone he was using wouldn’t freeze. The radio crashed so often that they hard coded the signal strength to 5 bars.

Of course, everything worked out in the end but the story of the demo is one that will resonate with every engineer forced to sign off on a project before it was ready and then having to watch someone demonstrate the result. The story ends with Grignon and his fellow engineers sitting in the fifth row watching Jobs give the demo and recounts their state when it was all over. Read the story to find out what it was.

Posted in General | Tagged | Leave a comment

Emacs Rocks Does WebRebels

I’ve been eagerly awaiting the posting of Magnar Sveen’s WebRebels video. It’s finally up but sadly the projection of his computer screen is unreadable even when blown up to full screen. That’s a great disappointment.

Of course, Sveen knows a thing or two about producing videos so he’s working on making the presentation watchable. He’s doing that by releasing segments of it miraculously cleaned up. The first is already done and ready for viewing. I’m not sure if he cleaned up the original feed or recreated it but it’s absolutely clear now.

Once again, we all owe Sveen a word of thanks. He does so much for the Emacs community that I don’t know how he has time to eat.

Update: The second segment is up here.

Posted in General | Tagged | 3 Comments

A Nice Example of Interactive Programming

I’ve written previously about interactive or exploratory coding. It’s the sort of thing that Emacs and Emacs Lisp make easy and attractive. You sort of feel your way along writing little snippets of code and then stitch them together into larger pieces such as functions. The approach is brilliantly illustrated at the beginning of Magnar Sveen’s Web Rebels talk where he builds a slide show function right before our eyes.

Now Kris Jenkins has posted a video that also demonstrates the technique. In just 16 minutes, Jenkins builds a Spotify client while we watch. This isn’t 16 minutes of watching him type though. Starting with a shell call to Apple Script telling it to ask the Spotify application to play a Pink Floyd track, he builds up a function to play any track. Then he builds up some functions to retrieve track data from Spotify. Finally he ties it all together with helm to provide a reasonably functional Spotify client runable from Emacs.

I love this way of programming; It’s one of the reasons I prefer Lisp to C for almost all projects. Even in C, I tended to write a function and then try it out but with lisp you can try out individual expressions and add more parts until you get what you want. If you’re an Emacs user or a Lisper you must watch this video. It will, I promise you, be worth your time. It’s just a bit over 16 minutes so it will fit nicely into one of your breaks.

Posted in Programming | Tagged , | 2 Comments

More Password Advice

Stavros Korokithakis has a nice post on choosing and securing passwords. Although his recommendations won’t come as news to Irreal readers, the post is still worthwhile because he explains the reasons behind his recommendations. Even more useful—especially for your Aunt Millie—is a list of ways to keep your password secure.

The end of his post is a “Best Practices Summary” that lists 6 rules for picking and securing your passwords. If everyone followed the advice in that list, password crackers would be pretty much out of business.

Of course, crackers needn’t fear imminent unemployment. If you follow the Dropbox link in Korokithakis’ post, you’ll see that in one study of 6 million passwords, 99.8% of them were in the top 10,000 list and 91% were in the top 1,000 list. As Korokithakis points out, you needn’t outrun the bear, only the other guy the bear is chasing. With statistics like that, it won’t be hard.

Posted in General | Tagged | 3 Comments