Tangling Dotfiles From an Org File

Despite the XDG base directory specification, configuration files are still stored all over our file systems. If you have a single machine, maintaining those files is not too much trouble—they’re almost all “set it and forget it”—but when you have multiple machines, especially if you frequently have to setup new machines, it can be a pain. A neat idea for dealing with this is to keep your dotfiles in an Org file and tangle them to their proper place. I wrote about that here and here.

The basic idea is that you put the contents of each config file into an Org source block and then tangle either a single block or all of them to write each config file to its proper place. That allows you to have a single source of truth for your dotfiles and makes setting up new machines—or even just updating a single config file—a snap.

NapoleonWils0n has an excellent video on implementing the idea. He used to keep all his dotfiles in a Git repository but that’s fairly difficult to set up and maintain. His Org based method handles both cases: it writes the dotfiles to their proper places but also builds a file for a Git repository. NapoleonWils0n doesn’t make clear the utility of maintaining a separate Git repository except to say it provides a further backup. Of course, you can put the Org file under version control and be done with it. Still, his process makes it clear how flexible the method is.

The video is 19 minutes, 23 seconds so plan accordingly. There’s a copy of the Org file he uses in his Github repository so don’t worry about trying to take in everything from the video.

Posted in General | Tagged , | Leave a comment

Abo-abo on Org-Roam

Regular readers know that I’m very taken with the Zettelkasten idea and have implemented my own (sort of) Zettelkasten with Org-mode. My homegrown solution is not very featureful or convenient so I installed org-roam (a FOSS alternative to the popular Roam application) to provide myself with a “real Zettelkasten.” Sadly, I’ve been too busy (lazy, really) to configure it or figure out how to use it. That’s made me feel vaguely guilty.

Fortunately, abo-abo has come to the rescue with his own post on org-roam. I say, “come to the rescue” because he, too, spent a lot of time getting around to actually using it. He’s been using it for less than a month but already loves it and considers it an upgrade to his previous way of taking notes. Take a look at his post to see a comparison between his old and new methods.

Being abo-abo, he’s tweaked things a bit with some wrapper code but he gives a pointer to org-roam configuration so you can use it as a starting point. That’s exactly what I intend to do. On the one hand, I was happy to find out that I’m not the only one who’s been sitting on org-roam for months. On the other hand, abo-abo has inspired me to get moving on what I’m sure will be an improvement to my notetaking. Feel free to excoriate me in the comments if I don’t report some progress in the near future.

At the end of abo-abo’s post, he shows a nice trick for automating a search for notes needing further action using the listify-key-sequence command and unread-command-events variable. I didn’t know about that but will add it to my toolkit.

Posted in General | Tagged , , | Leave a comment

Happy New Year

There’s not much happening today so I’m going to settle for wishing all Irreal readers a very Happy New Year from the Minions and me.

Posted in General | Leave a comment

A Global Hyper Key

There’s an interesting article over at Prodtyping that illustrates how to implement a global Hyper key on the Mac. By “global” I mean it works everywhere, not just Emacs. The idea is to use Hyper as a global shortcut key. The article shows the setup for making the Caps Lock serve as Hyper and uses it to launch Atom, Chrome, or iTerm.

The method uses Karabiner/Hammerspoon to do the key mapping and to fire off the appropriate application based on the key that Hyper is modifying. That last step requires a bit of Lua but Prodtyping shows a template that you can use to start your own application choice.

Evan Travers has a similar post that discusses using Hammerspoon to create and map a Hyper key. If you’re running a Mac and are interested in setting up a universal shortcut key, both posts are worth reading.

I use function keys to switch between my frequently used apps and within Emacs I have the fn key mapped to (Emacs’) Hyper. That works well for me but if you’re looking for a more general solution and you’re on a Mac, the solution in the two posts may be a good one.

Posted in General | Tagged , | Leave a comment

Emacs FAQ

Over at the Emacs subreddit, okimka suggests that an Emacs FAQ for the subreddit would be a good idea and even suggests a few questions and their answers. The comments generally complained about the questions and some of the answers but miss, I think, the main point.

Those on reddit and elsewhere spend a lot of time answering the same questions over and over. A lot of it is responding to the usual misinformed opinions of those who don’t even use Emacs. My favorite is “Emacs is unusable out of the box,” but there are also the complaints about it being bloated and slow. Rather than respond to those complaints over and over it makes sense to have some place we can point people to.

In addition to answering the usual complaints such an FAQ could address some of the other usual questions that we get repeatedly. I believe such an FAQ would be useful; what do you think?

Posted in General | Tagged | Leave a comment

More on Emacs and the Unix Way

Protesilaos Stavrou (Prot) just put up an interesting post that serves as a nice coda to yesterday’s Irreal post, Emacs As a 2D CLI. His take is not so much that Emacs fits nicely into the Unix paradigm but that for some things at least, it’s better. He builds his post around an email he got asking him why one should switch to Emacs.

His response is that if your current solution is working for you, there’s no reason to switch. Like me, Prot came to Emacs from Vim but for different reasons. We agree that Emacs and Vim offer two different types of workflow and reasonable people can prefer either over the other. He views Emacs as providing a unifying integration over the tools that he uses. Rather than writing glue code for every pipeline, he lets Emacs take care of that.

A couple of years ago, I wrote about a video in which Luke Smith asked people to send him videos (only) to convince him to switch to Emacs. I was not kind in my commentary because I found it annoying and presumptuous to ask the rest of the world to spend time providing very a specific type of content so he wouldn’t have to do his own research. His video was all the more annoying given that what he wanted was already available if he’d bothered to look. By happenstance, Prot’s interlocutor offers up another video by Smith in which he talks about the offerings he received and how he still wasn’t going to switch or even give Emacs and honest try. That video is as annoying as the first. His comments on Org-mode were particularly tiresome because they boiled down to, ‘Everyone says Org is cool; I don’t know anything about it; It’s not for me.’

Prot calls him out on the video saying he’s perfectly free to use whatever works best for him but that if he’s going to comment on Emacs he should at least know what he’s talking about. In other words, that he should give it an honest try for 6 months and then tell us what he thinks.

Prot’s post make a few other good points and also provides an alternative view of the Emacs/Unix question. It’s well worth a few minutes of your time.

Posted in General | Tagged | Leave a comment

Emacs As a 2D CLI

Hongchao Liu has an interesting discussion about viewing Emacs as a two dimensional command line interface. He begins by arguing that Emacs does, in fact, adhere to the Unix principal of doing one thing well. That’s very counterintuitive but Liu says that if you view Emacs’ domain as text, then the one thing that it does well is to wrangle text. That’s not a new idea, of course; I wrote about it back in 2017 in connection with a post from ambrevar. Still, it’s a useful way of thinking about Emacs and its environment.

Liu’s other insight is that if you think about the normal Unix command line interface, it’s really about individual programs that have no knowledge of each other communicating through a text stream and they do this in a programming environment that we call the shell. That environment is inherently one dimension because the flow of data between the programs is basically a line of text.

With that in mind, Emacs can be viewed as a two dimensional command line interface. Rather than dealing with a line of text, Emacs deals with a two dimensional array of lines. In this case, the programming environment is Emacs rather than the shell. Liu uses the example of starting with a Magit commit log, jumping to a diff of the commit, and then to the actual source code of the program. As with the Unix pipeline, none of the programs know about each other and simply perform their work on the two dimensional array of lines that they are passed.

It’s an illuminating point of view and provides a neat answer to those who say Emacs is the anti-Unix. Take a look at Liu’s post. I think you’ll find it interesting.

Posted in General | Tagged | Leave a comment

Org Mode for Reproducible Research

Thibault Lestang of Oxford University has a very nice video that makes the case for using Emacs and, in particular, Org-mode for academic research. He’s very interested in reproducible research and his talk is centered around the idea of Org-mode making reproducible research easy and natural.

A significant, recurrent theme of the video is the importance of keeping your document consistent. In this, it reminds me of Mike Hamrick’s video on producing consistent documents with Org-mode. The ability to call a code block dynamically for a value means that you don’t have write hard values for results and this, in turn, helps keep your document consistent as the data or its analysis change.

Lestang gives a demonstration of using Org-mode in this way so it’s a good resource for those interested in finding effective tools for organizing and reporting their research. He admits, in fact, that the video is meant as evangelism for Emacs for those who may not come to it naturally.

The video is 33 minutes long so you’ll need to block out some time but it’s an interesting talk and well worth your while if you’re wondering whether it’s worth the effort to learn Emacs and Org-mode.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: C++

It’s Christmas and it’s Friday so here’s a little gift from the Minions and me:

Posted in General | Tagged , | Leave a comment

This Is Tech Journalism II

A couple of weeks ago I made fun of tech journalism. It was an easy—some might even say a cheap—shot but Gizmodo brings this kind of ridicule on themselves. Sadly, besides the buffoonery, there’s actual malpractice going on.

Cellebrite is an Israeli company offering forensic software to law enforcement agencies. Recently, they published a blog post concerning their ability to extract information from Signal, a secure messaging app. The post was a little over the top and to their credit, Cellebrite replaced the post with a more moderate one.

That, however, did not stop the BBC and other “legitimate news sources” from publishing stories claiming that Cellebrite had cracked Signal’s encryption. Cellebrite’s post didn’t say that and it’s certainly not true. The true story is hardly worth telling. It’s like \(2+2=4\), film at 11. You can read that story at Signal’s Website.

Nobody with any brains takes news organizations specializing in Tech seriously. They are almost always wrong and appear to be more interested in clicks than news. But the BBC and organizations like Forbes, Bloomberg, the New York Times, and the others are supposed to be “real” news sources and yet they propagate the same sorts of nonsense. They shouldn’t wonder that anyone paying attention discounts everything they say.

Posted in General | Tagged | Leave a comment