Substitute Command Keys

Marcin Borkowski (mbork) has a nice post on the Emacs substitute-command-keys command. The TL;DR is that it’s a way of mapping a command name to its keybinding. I’ve long been familiar with it but only in the context of Emacs Doc strings. For example, here’s the Doc string from one of my custom macros:

  "Convenience macro to generate a key sequence map entry
for \\[prettify-key-sequence]."

the \\[prettify-key-sequence] is mapped to whatever the current binding for prettify-key-sequence is. It’s nice because I can change the binding without having to worry about updating the documentation.

Mbork’s post tells us that my use above is really just a special case of a more general facility: substitute-command-keys. You can programmatically convert a function name to its binding by calling substitute-command-keys.

I’m not sure where you’d want to use this other than in a Doc string (or maybe an Org doc) but I’m ready to be educated on the matter. I can’t remember where I learned about using \\[...] in the Doc string. It was probably from seeing it in some function in Emacs core. One thing for sure, it’s not easy to discover without looking for it explicitly or stumbling across it like I probably did.

In any event, this is a useful thing to know. It’s a great example of how Emacs is self documenting.

Posted in General | Tagged | Leave a comment

Emacs Drawing Tools

Over at the Emacs subreddit, ismbks asks about drawing tools for Emacs. If you’re like me, the only thing that comes to mind is artist-mode with possible export through ditaa. That combination has always met my needs but it is pretty rudimentary and mostly confined to block diagrams.

The comments have some other solutions. On really nice example is AKIYAMA Kouhei’s Emacs Easy Draw. It’s very interactive and has nice line drawing capabilities. Take a look at the demo on its GitHub page to get an idea of what it can do.

Another commenter recommends PlantUML, which is good for flow diagrams and fancy block diagrams. It’s a markup application rather than interactive if you prefer that way of working.

Of course, all these applications are meant for engineers needing to draw engineering diagrams and not for artists who want to do serious digital art. Emacs is probably never going to support that sort of thing and why should it? After all, there are applications specialized for that and it’s hard to imagine a need for doing it from within Emacs.

Posted in General | Tagged | Leave a comment

Making It Easy To Unsubscribe

One of the really annoying aspects of the digital age is trying to end an online subscription. These subscriptions are always easy to sign up for but very difficult to end. My favorite example is the New York Times. They bombard me daily with exhortations to take a trial subscription. If I don’t like it, they say, I can quit at any time.

What they don’t say is that while subscribing requires little more than a click, unsubscribing requires a phone call to the NYT where they do everything they can to talk you out of dropping your subscription and generally make ending it as difficult as possible. Everybody but the marketers hate this tactic.

Now, at last, it’s going to end. The Federal Trade Commission has announced a new rule that makes the tactic illegal. Basically the rules says that it has to be as easy to quit as it is to sign up. That would mean, for example, that I could quit my NYT subscription with a click or perhaps an email. No more arguing with a salesman trying to keep me in the fold.

As you probably know, Irreal is inclined to be skeptical about the utility of involving government bureaucrats in our affairs and if I were consistent, I’d be against this intervention too but, I must admit, I’m happy to see this rule. It is, I think, merely insisting that companies be honest and equitable with their customers.

The marketeers who see abusing their customers as a viable tactic will doubtlessly try to find a ways to skirt the regulations. It will be interesting to see what happens.

Posted in General | Tagged | Leave a comment

Apple Was Right

Irreal has been preaching for years about the dangers of giving the nannies a backdoor into our private communications. They scream, “Think of the children” at us and insist that they’re the good guys and be trusted to safeguard our privacy. It’s laughable, of course.

Say whatever you want about Apple but they have always said “No” to such requests and have even gone to court to defend their right to do so. Chris Smith, over at BGR, makes an excellent point. The recent breach of the law enforcement wiretap infrastructure at AT&T, Verizon, and Lumen by the Chinese Hacking group Salt Typhoon shows that there’s no such thing as a secure backdoor, and that Apple was right to refuse to pretend that there is.

As Smith points out, this wire tapping interface was exactly that the nannies want: a backdoor into the communication channel. And yet, hackers have been inside the system for months or longer, downloading information and otherwise abusing the system.

I think it’s wrong to put this down to incompetence—even though the government’s involved. As most Irreal readers know, once a system becomes known and has Internet access, it will be breached. The same is true for a putative iPhone backdoor.

It will become known because the first time law enforcement uses it to gather evidence, the defense will insist on learning where they got the data and they will either have to reveal the backdoor or let the criminal walk.

Once it’s known that the backdoor exists, hackers everywhere will work on breaching it. Remember, these attackers will include nation states with virtually unlimited resources. The prize is great enough that it would be worth throwing whatever resources are required to obtain it. My guess is that everyone will be surprised at how fast that happens.

The snake oil salesmen will tell you they have a foolproof system that’s perfectly safe. Don’t believe them. They’re no more reliable than their progenitors. If we want our communications secure, we must continue to insist that there be no backdoors.

Added during publication

Bruce Schneier makes the same point.

Posted in General | Tagged | Leave a comment

Moving Among Emacs Windows

Once you discover the utility of having multiple windows in a single Emacs frame, the question of how to switch between those windows arises naturally. Emacs, of course, has you covered. You can use Ctrl+x o to cycle between windows. That’s great if you have only a couple of windows in a frame but it becomes tedious when there are multiple windows. That, of course, happens often once you get used to making maximum use of Emacs.

Marie K. Ekeberg over at TheMKat has a solution. It’s a nice solution in the sense that it’s built into Emacs so you can use it without adding anything extra. That solution is windmove. Ekeberg didn’t like the default bindings but, as she says, it’s easy to change them to whatever is comfortable for you.

I used windmove for a while but I have since moved to ace-window, a wonderful app from abo-abo that, when invoked, labels each visible window with a number that you can use to select that window you want to move to. I’ve bound it to Ctrl+x o so I didn’t have to learn a new binding. The nice thing is that if there are only two windows—my usual situation—ace-window will simply switch to the other without further ado.

When I brought up the ace-window repository while writing this post, I noticed that there are a bunch of possible actions available. I never use any of them except switching but you may find some of them useful.

The TL;DR is that if you routinely have more than two windows in a frame, ace-window is a must have app. I’ve been using it for years and wouldn’t want to live without it.

Posted in General | Tagged | Leave a comment

Organizing A Book In Org Mode

Somehow, I missed this great reference to Ron Galloway’s outline for using Org mode to organize a book. Fortunately, Sacha had me covered with her excellent Emacs News.

If you haven’t written a book before, it may be surprising how necessary Galloway’s template is for the actual mechanics of writing a book. Even if you’re organized and divide your book into a main file and separate files for each chapter, you’ll soon discover that you want some place to put notes, log your progress, track your references, and brainstorm ideas.

Every author solves these problems in different ways with different file structures but Org is especially amenable to providing a useful framework for organizing these things.

I wrote my books before I discovered Org mode—or perhaps before it existed—but my structure was essentially the same. The nice thing about Org is that you can access—and work on—all those files from a single top level file.

If you’re writing or considering writing a book, take a look at Galloway’s outline. It’s an excellent starting point for our own project.

Posted in General | Tagged , | Leave a comment

Unique Card Decks Revisited

Five years ago, I wrote about an interesting factoid that Paul Graham posted (probably to Twitter) concerning how many unique orderings of a standard 52 playing card deck there are. Almost all Irreal readers will immediately raise their hands shouting, “I know, I know! 52!.”

The point of that post was to get a feel for how large 52! really is. It’s way bigger than your intuition tells you it is. The TL;DR from that post was that every time you pick up a well shuffled card deck it is almost certainly unique for all time, past and future.

Over at czep.net there’s an interesting post that takes another look at 52! and how unimaginably large it is. To do this, the post proposes a series of games. In one such game, you start a timer counting down from 52! to 0 once a second and walk around the equator taking one step every billion years. When you complete the circuit, you take a single drop of water from the Pacific ocean and start again. When the Pacific ocean is dry, you place a single sheet of paper on the ground, refill the ocean, and start again. When the sheets reach from the Earth to the sun, check the timer and you’ll notice that the leftmost digits still haven’t changed.

Take a look at the post. It’s astounding how large 52! really is even though at \(\approx 8 \times 10^{67}\) it may not seem that large to those of us used to dealing with large numbers. If you have to perform 52! operations, you’re never going to finish.

Posted in General | Tagged | Leave a comment

The Downside Of Living A Digital Life

Regular readers know that for several years I’ve been endeavoring to live a “digital life”. What that means—more or less—is eschewing pencil and paper, paper bills, checks, dead tree books, physical credit cards, and even things like keys when I can. My goal is to be able to manage my life from my computer and to be able to leave the house with nothing but my phone. I’ve pretty much met those goals except for my car keys and driver’s license.

It’s no surprise that all this depends critically on two things:

  1. Electricity to charge device batteries
  2. A reliable Internet connection

As Milton recently made clear, that infrastructure can be fragile. The bunker lost power for 3 days and with it, any semblance of living a digital life. My devices were all charged up, of course, but that doesn’t last long when you’re trying to get things done and they can’t be recharged. I have a backup battery that kept our two phones charged but we did have to cut way back on usage.

WiFi was down—and therefore our “Smart Home” as well but cell phone service was still on so we had broadband service when we absolutely needed to get on the Internet or text someone. As I said, there’s nothing like wondering how you’re going to charge your phone to make you positively stingy about its use.

Fortunately, the bunker is overflowing with dead tree books acquired before I started down the digital life path so we were able to keep ourselves amused. Seven years ago, I bought a four pack of these Etekcity Lanterns, which provided light for reading and other things when it got dark. I don’t use them very often but they’re wonderfully useful when you need them. They’re bright and the batteries (AA) last for a long time (up to 50 hours according to Etekcity). I changed out the original batteries for the first time during the latest outage. If you—even sometimes—lose power you really should invest. They’re cheap and reliable and can help ease you through a power outage.

In any case, Irreal’s adventure in roughing it is over and we’re glad to be back living a digital life.

Posted in General | Tagged | Leave a comment

Milton After Action Report

Here I am. We just got power back today at 15:19. We did have broadband—although the signal was weak—but I didn’t have enough power on my laptop to compose a reasonable post. As you might imagine, everyone we know in the world was texting asking how we were so I was doing my best to conserve my phone battery. The weather people are saying this is the worst hurricane in the Tampa area in a hundred years.

The good news is that the bunker survived without any damage. There was plenty of tree branches all over the area but no downed trees in our immediate area, although there were some trees down fairly close to the bunker. Lots of people in the Tampa area did suffer significant damage but most of that was storm surge.

Tomorrow Irreal will continue its quest for world domination. The minions and I are hoping that we’ve seen the last of significant hurricane events for the year. Two in two weeks are more than enough.

UPDATE [2024-10-13 Sun 10:12]: buffer → bunker (thanks to Michael Ashley for the heads up)

Posted in General | Tagged | Leave a comment

Writing With Emacs Redux

Four years ago I wrote about James Gill’s list of Emacs resources for writers. It was a curated list of resources that addressed writing prose of various sorts with Emacs. In April, I revisited the list. Judging from what I wrote, I had forgotten about my first post.

Now, I’m writing about it again because of Gill’s latest post about the list. In it, he says that surprisingly to him, that repository is the most popular of all his Github repositories. It’s not surprising to me because it’s a really great resource.

What was surprising to me, as I read down the his list, is how any are things that I have written about on Irreal. You may or may not think of that as an indication of quality but one thing for sure, it’s indicative of how interesting they are to me.

Regardless, if you use Emacs to write prose—for a blog, for reports, for articles, or even for books—you should take a look at this list. There’s sure to be something useful to you in it.

Posted in General | Tagged | Leave a comment