Programmatic Programming with Graphviz

Correl Roush has a very nice post that beautifully illustrates the idea of writing code to write code. It’s a tremendously powerful idea because it lets you leverage some other program or programming language to do a task that requires specialized knowledge to code or is otherwise too hard to do directly. Examples that I’ve used are writing code to generate troff source as an intermediate to producing typeset output and code to generate graphviz source as an intermediate to generating a graph.

Roush gives us a nice example of generating graphviz (dot) source code to produce a nice looking graph. The particular problem she’s addressing is building a tool that you can point at a git repository and have it produce a nice graph of the commits. That seems unreasonably hard if you approach the problem ab initio but is very tractable if you leverage git and graphviz to do the hard work. Git can produce a topologically sorted list of commits and graphviz can do all the drawing of the graphs. All Roush has to do is add some glue code.

Roush decided to work in elisp and builds up her application step by step. She starts by showing the dot input she wants to produce and then writes the code to produce it. By iterating through more complicated graphs until she gets the final result, she shows to build the application iteratively, a programming method that I especially like.

I also like the way Roush uses data abstraction. Her list-based implementation may or may not scale to huge git repositories but her use of data abstraction makes it almost trivial to move to a more efficient implementation if required.

Posted in General | Tagged | Leave a comment

Emacs Shells

One of the things that’s harder than it should be in Emacs is embedded shells. You can type Meta+x shell and sort of have a shell. Except it doesn’t work very well. There are other options but it can be really confusing for the n00b or even a semi-experienced user not familiar with invoking shells from Emacs.

Derek Taylor has a video that explains and compares Emacs shells. He—rightly in my opinion—rejects the shell and ansi-term command as basically unusable for non-trivial commands. Until fairly recently there wasn’t a good solution if you wanted a traditional shell.

As Taylor says, that has recently been remedied by the introduction of vterm. It requires the relatively new module system but solves most of the problems for those who want to have a “normal” Unix shell. It solves all the problems with shell and ansi-term and lets you run a full-function shell from within Emacs.

But that’s not all, of course. There’s also eshell. It’s both less and more than a Unix shell. Some things don’t work as well but eshell has capabilities well beyond those of traditional shells. Taylor demonstrates some—but not all—of those capabilities. There are others that he doesn’t demonstrate.

The video is 17 minutes, 20 seconds long—a bit shorter if you skip the shoutouts at the end—so you’ll have to schedule some time. If you’ve been confused by Emacs shells, take a look at Taylor’s video. It’s a good summary.

Posted in General | Tagged | Leave a comment

Voting in Estonia

Almost every expert says that you can’t vote online safely. You see the opinion so often it’s become received wisdom. Yet that’s exactly what happens in Estonia. Estonians can vote from anywhere in the world and can vote as often as they like—only the last vote counts, of course. To Estonians, this only makes sense. All their interactions with the government can be performed digitally.

I’ve written about digital life in Estonia before. It is, I think, something we should all strive for. In Estonia, you don’t have to fill out the same personal information over and over again as you deal with different government agencies. And you certainly don’t have to spend hours at the DMV to renew your driver’s license. Everything is linked to a digital ID that is used to mediate all those transactions.

Of course, that sounds like it could be a dystopian nightmare. The government has all your information conveniently linked by that ID. On the other hand, things are not much better in, say, the US. The government still has all your information, it’s just spread out among many agencies. It may take a little effort but they can certainly pull together all your information when they need to. Estonia, for its part, has taken pains to protect their citizens’ data and to guarantee that it belongs to the citizen not the government.

I don’t have enough data or expertise to evaluate how well they meet that goal but Estonians seem happy with the results. It would probably be hard for any Western country to replicate what they have. They started out fresh when they Soviet Union fell and they’re a relatively small country. Still, they have a system worth emulating to the extent we can. In the US that would require ironclad constitutional guarantees of privacy and ownership of your data for a start. That would be hard and probably won’t happen but it’s a worthy goal.

Posted in General | Tagged | Leave a comment

How To Get Rid of Cookie Popups

One of the annoying consequences of the GDPR is the popups asking you if it’s okay to set cookies. Mostly, those cookies are used to track us and are something we definitely don’t want to enable. Sadly, some of those popups won’t go away until you consent to cookies and, worse, are modal so that they continue to block the text you’re trying to read.

Alain M. Lafon is not the only one to notice this problem but he found a solution and has a useful post that explains how to get rid of the popups. The TL;DR is that he uses uBlock to inhibit the popups and prevent tracking. The video with the post might lead you to believe that the solution works only for Firefox and Chromium but uBlock works with

  • Chromium
  • Firefox
  • Microsoft Edge
  • Safari

so the solution works on most browsers and regardless of what OS you’re using.

I’m not sure but I think that the latest Safari (Version 14.0) does essentially the same thing. It blocks trackers and provides a list of the trackers it blocked. Regardless, you can follow Lafon’s advice and install uBlock if you’re being bedeviled by popup cookie notices or worried about being tracked.

As I’ve said before, these people have no right to follow us around the Internet so don’t let them guilt you about blocking their tracking cookies. If they want to show us ads, they can stop the tracking.

Posted in General | Tagged | Leave a comment

A Medievalist Uses Emacs

The title almost sounds like something you’d see headlining a parody but it turns out that a medievalist using Emacs is really what this post is about. Joseph R. Johnson is a medievalist at Georgetown who spends a great deal of his time transcribing medieval texts.

That’s harder than you might think—if that’s possible—because different scribes produced subtly different renditions and because they used a lot of abbreviations similar to present day contractions (like “don’t” for “do not”) but not as deterministic as today’s contractions. Johnson’s post has an example that shows how complex those abbreviations can be.

Because the abbreviations can be ambiguous, Johnson puts the letters that the diacritical marks represent in parentheses. An example is v(ost)re where the “ost” in parentheses is represented by a diacritical mark. The problem is that all those parentheses were hard on his hands and he was worried about RSI (he should try Lisp).

The point of this long story is that Johnson is an Emacs user who took the time to learn a little Elisp so that he could leverage its power to ease his transcribing. He implemented an Emacs minor mode that implements easy to type shortcuts that save him from having to type all those parentheses. The post shows several iterations of his efforts.

I love stories like this because it makes the important point that if you deal with text you should be using Emacs. As others have said, Emacs is not so much an editor as it is a framework for dealing with text. That may include editing but it also includes things like email, RSS, playing music, and who knows what. As most of you know, I think of Emacs as a lightweight Lisp Machine, which means, of course, that you can program it to do almost anything. Johnson’s use of Emacs to help his transcription of medieval texts is a case in point.

Posted in General | Tagged | Leave a comment

Everyday Carry Progress Report

Regular readers know that I’m all in on living a digital life and in particular on getting my everyday carry down to my smartphone (see here and here). This post is a progress report.

Ironically, COVID-19 has helped advance my program. These days, no one wants to handle cash or pass around credit cards so even holdouts like my supermarket (Publix) have enabled Apple Pay. Of course, there isn’t much opportunity to take advantage of that right now with everyone hunkering down at home but once the COVID-19 threat passes, I can probably get by without carrying any credit cards.

That leaves my driver’s license as the only reason to carry a wallet. Happily, Florida is finally moving ahead with their plans for a digital license. According to the press release, Floridians should be able to apply for one sometime in 2021. Once that happens, I should be able to leave my wallet at home.

The only barrier keeping me from realizing my goal of an everyday carry consisting only of my phone is my car. My current car has a fob that allows me to open the door and start the car. There is absolutely no reason this couldn’t be migrated to my phone but the auto manufacturers are making heaving going of the whole thing. Nevertheless, At least some cars in next year’s models with have the ability to open and start the car from a phone.

By the end of next year, I expect that I’ll have reached my goal with, perhaps, the exception of ditching my car keys. That may take a bit longer but it’s coming.

Posted in General | Tagged | Leave a comment

Org Code Block Results

John Herrlin has a followup to his previous post about Org-mode code blocks. This one deals with controlling the output of a block’s execution. I usually think of the :results parameter as a way of choosing where the results from the code block should come from. That can be either the “value” of the block (in a lisp sense) or whatever the block outputs to stdout.

But it turns out that the :results parameter can do much more. In a sense, it also controls where the results go. For example, you can have it append the output of the block to previous outputs. Or you can arrange for the results to be wrapped in another code block. Herrlin gives examples of how to take advantage of these capabilities. See his post for the details.

It’s a nice post and definitely worth your time even if you’re already familiar with using Org code blocks.

Posted in General | Tagged , | Leave a comment

Useful Tools

Nikhil Marathe has an interesting post on what he calls “Mystery Knowledge.” By Mystery Knowledge he means knowledge that you aren’t apt to discover on your own but that is easy to learn once it’s been pointed out and, when it has been pointed out, can make a big difference in your productivity.

Most of his post illustrates the point with some useful tools that make your day-to-day work easier. If you’re an old-timey command line guy, you’re reaction is probably, “Well yeah. Who doesn’t know about those?” But a lot of younger developers work mainly with browsers and GUI’s and have never come across things like the file command or wireshark. Marathe has a whole list of command line tools that can help with coding and debugging, even if you work mainly with a GUI.

When a tool is specific to a particular OS, Marathe identifies a similar tool for the other operating systems when one is available. It doesn’t matter if you work with Windows, Linux, or macOS; Marathe considers tools and techniques for all of them.

This is a nice post with a lot of valuable information. Even if you are one of the command line folks, it’s worth a read. You might learn about a command or command flag that you weren’t aware of.

Posted in General | Tagged | Leave a comment

Compiling Gccemacs on macOS

I’ve written a few times about gccemacs (1, 2, 3) and what it means for the future of Emacs. The good news is that it’s being merged into the Master branch and with any luck will make its first official appearance when Emacs 28.1 is released.

In the mean time, the more adventurous can try things out by compiling the development version of Emacs 28 from its Git repository. Of course, Emacs 28 is still very early in its development cycle and is not stable. Still, if you just want to try it out or have a particular need for the speed boost, there’s no reason not to try it out.

Luca Cambiaghi really needs the speed so he’s compiled the macOS gccemacs repository for his everyday use. He gives a detailed explanation of his steps and the problems he found. If you’re on macOS and want to try out gccemacs, his post is a good resource. I’d be hesitant to use it for anything other than experimentation or tire kicking—although Cambiaghi appears to be using it as his working version—but if you want to see what all the excitement is about, follow Cambiaghi’s recipe to try it out. He also has something to say about Doom Emacs so if you’re interested in Doom, you should also check out his post.

Posted in General | Tagged | Leave a comment

Is Emacs Doomed?

No. Of course not. The commentary one sees on Emacs is much like that one sees for Apple: This latest [smartphone | editor] is an [iPhone | Emacs] killer. Besides, the iPhone/Emacs is old, tired technology. It’s doomed. And yet, both seem to not only survive but thrive.

Oivvio Polite has a personal take on the question. He started using Emacs in 1999 so his views are informed. Oddly, his major complaint is that Emacs users have to build the editor they want by themselves. I, and many others, have always considered that one of Emacs’ advantages. Certainly, I never considered it an imposition when I started with Emacs. I began with vanilla Emacs and added the bits I needed for C, Lisp, and Scheme. It all seemed natural and unintimidating. The introduction of the package system made things even easier.

Still, some people prefer an “out-of-the-box” experience and aren’t interested in building their own. As usual, Emacs has you covered. If you want a light-weight solution, there are several starter kits such as Bozhidar Batsov’s Prelude or Steve Purcell’s Emacs configuration. If you want a more comprehensive solution, there are the Spacemacs and Doom distributions. A lot of folks think Spacemacs and Doom are for immigrants from Vim but as Derek Taylor says, sometimes n00bs use Spacemacs and Doom because they’re easier.

Polite is not a n00b but he does like Doom and thinks it points to the way forward for Emacs. I agree that they’re a real boon for some users but continue to believe that vanilla Emacs has a long and bright future. Take a look at Polite’s post for his views and see if you agree.

Posted in General | Tagged | Leave a comment