Sudo-edit

Here’s a nifty bit of Elisp to make opening a file as root a bit easier:

When I first saw it, the idea seemed familiar and it is, in fact, very similar to some code offered by Bozhidar Batsov. I (very) slightly prefer Batsov’s version because it handles my most frequent use case by default. Most of the time when I want to edit a root file, I forget to open it with the sudo tag and have to abort the edit and reopen it. Batsov’s version handles this automatically.

Posted in General | Tagged | Leave a comment

Red Meat Friday: Life Of An Emacser

As anyone who has ventured into the event horizon of their Emacs configuration knows, it can be extraordinarily difficult to get out. As the cartoon suggests, sometimes it can even suck up every available mental cycle leaving no time for other pursuits such as work.

Users of those other editors doubtlessly consider the cartoon a ding on Emacs but every Emacs user I know considers that a feature not a bug. After all, what could be more fun than hacking on your Emacs configuration? That other stuff can wait.

Posted in General | Tagged , | Leave a comment

A Short Essay on Reproducible Research

As everyone around here knows, I am a big fan of reproducible research and the idea of including data, code, and explanatory text in the same file. For researchers, that makes it easy for others to verify and extend the results but it’s also a great way for others to explain some process and embed the code to implement it in a single file.

Norman Walsh has a short post that explores these ideas by using the Org-mode Babel functionality. His example involves calculating the Fibonacci sequence. There’s some explanatory text—more of a place holder, really—and then some code to implement the calculation. The nice thing about Babel, of course, is that you can actually execute that code and place the result right in your document. As Mike Hamrick has explained, that makes it easy to keep the results consistent with the data as it evolves.

If you’re writing explanatory material that involves code samples, I know of no better way than using Org mode. You get consistent documents that can be exported to HTML, PDF, and many other formats. Take a look at Walsh’s post and Hamrick’s video to see this in action.

I know I flog this idea a lot but it’s such a powerful method that I’m always amazed by it. If you do research or write explanatory material, you really should consider the Org mode/Babel/reproducible research approach.

Posted in General | Tagged , , | Leave a comment

On The Collaboration of Ken Thompson and Dennis Ritchie

Periodically I see a reference to Ken Thompson’s 1983 Turning Award Lecture, Reflections on Trusting Trust, and I almost always end up commenting on it. It’s, by far, my favorite CS paper and I’m always delighted at the brilliant trick that it describes. The Jargon File calls it a truly moby hack and if you’re not familiar with it you should definitely follow the first link. The paper is short and very accessible.

The talk and paper are about that hack and it so outshines everything else Thompson had to say that it’s easy to miss a small but amazing unrelated detail. In the introduction, Thompson comments on his collaboration with Dennis Ritchie and how seamless that collaboration was. He says that in all the years they’d worked together he could recall only one instance of “miscoordination of work” In that case they both wrote the same 20-line assembly language program. Thompson was astounded when he realized they’d written exactly the same code right down to the character level.

Imagine being so in tune with a colleague that the only time you misallocate your joint efforts, you end up producing exactly the same output. That wonderful partnership shines through in the work that they created. Unix was so successful that Rob Pike argued, more or less, that Operating System research had come to a stop.

Posted in General | Tagged | Leave a comment

Time To Ditch Your Wallet

It’s been a while since I’ve written the walletless aspect of my quest for a digital lifestyle. Those of you who are long time readers know that my end goal to to be able to leave the house with nothing but my iPhone. On the one hand, I’m almost there. On the other, I’m not any closer than I was the last time I wrote about this.

Entry to my house is controlled from from my iPhone and if I leave the neighborhood and return the door unlocks automatically so I don’t even need to take out my phone. That means I no longer have to carry house keys.

Sadly, I still don’t have a car that is completely keyless. Although my current car allows me to open the door and even warm it up with my phone, I still need the key fob to drive it.

That brings us to my wallet. Apple Pay means that I theoretically don’t need to carry credit cards but, of course, there’s always the odd merchant who still won’t accept NFC payments. The driver’s license situation is even worse: Florida has had a digital license—which I have—for over a year but they still haven’t officially rolled out the program so I still need to carry my license. Their pilot program has been ongoing since 2011 so I’m hoping they’ll launch soon. Right now, I carry my license and a single credit card in my Slim Clip wallet, which is very compact but still something else I have to carry.

This post was inspired by Christine Romero-Chan’s article, In 2023, it’s time to finally ditch your real wallet for Apple Pay. She says that it’s mostly possible to do away with carrying credit cards but that you do occasionally find a merchant who won’t accept it. Similarly, she is still waiting for California to get its act together with a digital license.

Meanwhile, Mike D’Avella who is currently living in Australia has basically ditched his wallet. He uses Apple Pay everywhere and—at least where he is—they have a digital driver’s license. I continue to hope and believe that Florida and the rest of the US will catch up soon.

Posted in General | Tagged | Leave a comment

Customizing Org Mode Exports

I have a longstanding fascination with document layout. It’s something I first learned from Rich Stevens. His books were always visually beautiful with a layout that showed an obsessive attention to detail. Fortunately, he wrote about his process extensively on his Website and was generous with his help when I was laying out my first book.

Like Stevens, I wrote and typeset my books with Groff. These days, I do all my writing with Org mode so I’m always interested in ways the make Org mode exports look better. I recently I came across two posts that address this very problem.

The first is by Norman Walsh. His interest is customizing PDF output from Org files. He didn’t like the way the default output made his documents look like academic papers. He includes output from both the default method and his customized method so that you can see the differences.

The second is by Colin McLear, a teacher who wants to use the same Org file to produce

  1. A set of notes for his students
  2. A set of slides for his lectures
  3. A handout version of the slides with additional content

Walsh’s post contains all his configuration except his setup files. Those are available in his GitHub repository.

Neither of these setups are likely to be exactly what you want but they’re ripe with ideas and show you how to make your own customizations. The ability to do this means that there’s no reason to do your writing in anything but Org. If you have special output requirements, it’s pretty easy to realize them with some simple configuration.

UPDATE [2023-01-14 Sat 18:55]: Added link to McLear’s post.

Posted in General | Tagged , | Leave a comment

Referring To Lines Between Regular Expressions In Org

Sacha Chua has a problem. From an Org file, she’d like to link to and possibly include a set of consecutive lines in another (or, I suppose, the same) file. The problem is that the target file may not be static so using line numbers, which are subject to change, doesn’t work.

Her solution is to define a custom link that includes two regular expressions. That way, she can link to and include the lines between the two regexps. Check out her post for an example and a few more details.

Most of Sacha’s post is the code that defines the new link type and that, of course, is worth studying just to see how one goes about doing that even if you aren’t interested in the problem Sacha’s solving. Like all of Sacha’s posts, it’s definitely worth taking a look at.

Posted in General | Tagged , | Leave a comment

Completions In Emacs 29

Speaking of Emacs 29 goodness, Robert Enzmann has a post that describes the new completions functionality in Emacs 29. Those changes mainly involve new configuration settings that subtly change how completions work.

The first set of settings items configure what happens when you press Tab to trigger a completion. These items mainly determine how many times you have to press Tab to get the completion list. There are two new settings for completion-auto-help:

  1. always, which displays the completion buffer after any attempt to compile
  2. visible, which displays completions only if they are already visible

Enzmann has some animated GIFs that show these options in action and help you understand how they work.

The second set of configuration items determine when the completions buffer is selected. The new options allow for the selection of the completions buffer either automatically or after the second Tab.

There are some new commands for navigating the completion buffer. You can take a look at Enzmann’s post to see these commands. As he says, you may want to change the bindings for them because the defaults use the arrow keys.

There’s also new functionality that allows the items in the completion buffer to be sorted according to user determined criteria. For example, Enzmann sorts his first by the frequency with which he uses them and secondly by length. This works by providing a sort routine so virtually any sorting criteria is possible.

Finally, there are a couple of minor items that determine the height of the completion buffer and the format of the items in that buffer.

Enzmann’s post is a nice précis of the new completion functionality and worth a read for those looking forward to the release of Emacs 29.1.

Posted in General | Tagged | Leave a comment

Emacs 29 Feature Freeze

There’s some good news on the Emacs front. Eli Zaretskii writes that it’s time for a feature freeze on Emacs 29. This is, of course, the first step in the final Emacs 29 release process. Eli says the goal is to release the first pretest of Emacs 29.1 in “a month or so”.

The Emacs 29 release cycle seems faster than usual, which is also good news. We all want a stable release but we also want the Emacs 29 goodness as soon as possible. The nice thing is that we can depend on Eli and the rest of the development team to do the right thing. We can be confident that there will be no release before its time but also that the developers are committed to getting it to us as soon as reasonably possible.

As I always say when I write about these events, I want to give my profound thanks to all the developers who selflessly contribute their time and effort for the benefit of all of us in the Emacs community.

Posted in General | Tagged | Leave a comment

Org Headline Tips

Nicolas Martyanoff has a (very) short post on some tips for dealing with Org mode headlines. There are three of them:

Do not split lines when adding headlines
This is a way to add another headline even if you are in the middle of some text. It’s simply a matter of adding a configuration item.
Jumping to a headline
This is a way of finding a headline in a large Org file. It’s advantage over a simple search is that you get completion.
Don’t Highlight TODO entries
By default Org will highlight the entire headline for a TODO entry. You can easily arrange to highlight only the TODO keyword if you prefer that behavior.

These are all simple configuration items and easy to implement if you want them. It’s not a huge thing and probably won’t have a large impact on your workflow but they do offer a way to make Org present data in a way more pleasing to you.

If you’re an Org user, this post is well worth the minute or two it will take to read it. Emacs (and Org) after all, are all about making your workflow easier and more pleasant. Martyanoff’s post offers a small way to do that.

Posted in General | Tagged , | Leave a comment