Everything Is a Command

Daniel de Haas has a post that I really like. In it, he sings the praises of the Emacs idea that everything is a command. If you’re an Emacser that may seem obvious but imagine not being familiar with Emacs and deciding to write an editor. Chances are you’d have a hard coded table that mapped keystrokes to actions or perhaps even some giant switch on key input with the appropriate code right there. That’s not just another legitimate alternative, it a terrible choice but one that the majority of editors make.

For example how would you enable the user to change the bindings if they need or want to? It’s virtually impossible. And it’s not just the basic navigation commands that can’t be remapped. There is no way to define and map alternative commands for more complicated editing commands. All that’s is easy in Emacs because

  1. Everything is a command, and
  2. Keybindings are kept in runtime editable structures.

In Emacs, even inserting a character into the current buffer when a key is pressed is a command. That means that if the user wants to perform some sort of filtering or translation of text input, it’s easy to do.

It also means, as de Haas says, that with Emacs you have a universal command palette. Every command, and therefore every action, can be brought up in a list to choose from. And it’s easy to combine those commands into a more complex action without knowing more than a modicum of Elisp.

The reddit comments to his post are also interesting. There’s a ton of ankle biting and uninformed commentary but there are also a lot of interesting comments that are on point and worth reading. Take a look at de Haas’ post and, if you have some spare time, the comments. It’s really interesting.

Posted in General | Tagged | Leave a comment

Emacs Documentation

Over at the Emacs subreddit, WarmToiletSeat0 posts an all-too-rare thank you for a part of Emacs that we all take for granted: documentation. Emacs is famously the self-documenting editor, of course, but most of us probably don’t think very deeply about what that means or how it happens.

When I hear that term, I usually think about docstrings. They make it possible to add easily accessed documentation to even your private Emacs code. Done well, as they most often are, a docstring tells you everything you need to know about a function. Like every other Emacs user, I call them up all the time through the help system.

But docstrings are just the beginning. Like every other big project, Emacs has one or more comprehensive manuals that document the system and how to use it. In the case of Emacs, those manuals are available in printed form, online, and—most importantly—as Info files accessible from Emacs itself. That means that an Emacs user can call up the Emacs manual or any of the auxiliary manuals from within Emacs and have the (hypertext) results displayed in an Emacs buffer.

That last phrase is, I think, important. When you call up Emacs documentation, it doesn’t fire up a PDF reader or shunt you off to some other application to read it. The results are right there in an Emacs buffer just like any other.

The point of WarmToiletSeat0’s post is to say thank you to the folks who provide that documentation. Sometimes it’s a developer but other times it’s just someone who steps up to perform a necessary and important function. I’d like to add my thanks to those unsung heroes who do the unglamorous work of documenting our editor and making it better for us all.

Posted in General | Tagged | Leave a comment

Lifehacker on Quitting Google

As a public service message and a followup to my previous post on quitting Google, I offer this article from Lifehacker on quitting Google. Lifehacker is not quite a site for the average person but neither is it a nerd site. It’s mostly a place where people can discover unique hacks to simplify their life. My major takeaway from the article is that quitting Google is more mainstream than I imagined. Nerds and privacy geeks are always talking about it but so, it seems, are “ordinary” people.

The article quotes Janet Vertesi, a sociology professor at Princeton and privacy export. She says that quitting Google is like getting divorced: it’s difficult but feels so good when you get through it.

The trick, she says, is to not try to do it all at once. The Google empire encompasses many areas and you’re likely using many of their services, so trying to replace everything at once can be overwhelming. Vertesi says to pick just one Google service—Chrome or Gmail, say—and find a replacement for that. Once you’ve successfully transitioned from that service, you can pick another to replace.

She also says that you shouldn’t just pick another company and replace all Google’s services with theirs. Rather, you want to experiment with new and better ways of performing the tasks that you used to use Google for. Just switching to another ecosystem won’t help you with that.

The article doesn’t suggest alternatives; it’s more about recommending a process for finding alternatives that suit you and integrating them into your workflow in a smooth and stressless way. It’s a quick and easy read and worth your time if you’re looking for a way to rid yourself of Google.

Posted in General | Tagged | Leave a comment

The Emacs From Scratch Cycle

Bsag over at but she’s a girl… has an interesting post on what she calls the Emacs from scratch cycle. She’s noticed that she goes through a roughly 3-year cycle of starting with a vanilla Emacs configuration, moving to one of the Emacs frameworks such as Doom, and then back again to vanilla Emacs. It is by no means a waste of time. In each cycle she learns a bit more about herself, her editing needs, and Emacs. As I put it before, it’s like tending a Japanese garden: a lifetime spent moving towards perfection but never achieving it.

In her latest cycle, she decided to resist adding packages unless she was irritated by not having their capability. Once installed, she makes a point of evaluating whether or not they actually improves things and deletes them if they don’t. She was, she said, surprised at how few packages she ended up keeping. I’m sort of like that except that I don’t have her culling discipline. I’m slow to add packages but once installed, I seldom delete them.

Bsag compares the process to making her own clothes. When you do that you end up with clothes that fit comfortably, are exactly the right length, are made from the fabrics you prefer, and even have the pockets exactly where you want them. But, making your clothes is, you know, a pain. It’s a lot of work and sometimes it seems easier to just go out and buy a premade garment.

My innate inertia and, let’s face it, laziness has saved me from this. I started out with a bare Emacs and added configuration items when I found I needed them or discovered something that appealed to me. That configuration has been expanding ever since. As I said, I seldom bother to prune it. Nor have I ever felt the need to declare Emacs configuration bankruptcy and start over. Currently, my configuration is about 2,500 lines so it’s still under control and probably will be for the rest of my life. I hardly ever restart Emacs and when I do it starts quickly so I see no need to change my ways.

Bsag has an interesting perspective. It’s worth spending a few minutes on her post.

Posted in General | Tagged | Leave a comment

PSA: Some Upcoming Casual Name Changes

If you’ve been around Irreal for as little as a few months, you know that I’m a fan of Charles Choi’s “Casual” utilities. They’re all basically the same. They add a transient menu to Emacs utilities such as Calc, Isearch, Info, and others so that you can have access to the more obscure subcommands of the utilities without having to remember key shortcuts that you hardly ever use.

I’ve found the Calc and Casual Info menus especially helpful since they have lots of subcommands that are useful but that I don’t use all that often. Others may find some of the other Casual menus useful.

Choi started out with the Isearch and Calc packages and probably didn’t realize that the idea could be extended to many other Emacs subsystems. Now that these packages have been a success, Choi realized that those early packages weren’t named in a manner consistent with the later ones. He therefore has announced some name changes. If you aren’t using the Calc or Isearch packages you have nothing to do. If you are, you will have to update your configuration to reflect the changes.

The plan is that the changes will occur on [2024-06-16 Sun] (that’s THIS Sunday) so you’ll need to have your configuration in place after that. I’ve updated my init.el to reflect the new Calc name but it’s still commented out. Given that all goes as planned, I’ll uncomment the new configuration on the 16th, evaluate it, and be up to date.

Posted in General | Tagged | Leave a comment

Apple Text Navigation and Emacs

Charles Choi is grateful—really grateful—to Apple for a longstanding UI feature. As many, many others have discovered, macOS apps recognize some basic Emacs navigation commands. Choi tells us something that I didn’t know. Apparently the NextStep programmers added the feature because they used Emacs and wanted familiar keystrokes when using the NextStep UI. When Apple acquired NextStep or NextStep acquired Apple—depending on who you ask—those bindings got inherited by macOS.

As I periodically remind everyone, it’s actually much better. You can map any macOS navigation command to an arbitrary keystroke. The above links points to a very easy way to do that. It basically amounts to installing a file that contains those bindings (the file is provided at the link). But wait. There’s more. You can add your own bindings to the file. It’s easy; try it and see.

Lots of GNU utilities respect Emacs bindings, of course, but Apple enables many of the Emacs navigation commands in all apps running on its Desktop. As I’ve said before, it takes a lot of the sting out of having to leave Emacs.

To channel Steve Jobs: One more thing. If this isn’t enough for you, take a look at emacs-everywhere. I’ve written about it a couple of times recently. The TL;DR is that when you’re in an arbitrary text box in macOS or Linux you can pop up an Emacs frame that lets you write the text in Emacs and save it to the text box.

Posted in General | Tagged , | Leave a comment

Always-yes

Gene Goykhman, like a lot of Emacs users—or simply computer users, for that matter—hates dealing with fussy details while working on his computer. One of his complaints in particular is that there are too many confirmations in some of his frequent tasks.

For example, when quitting and saving an Ediff merge, he has to respond to two separate confirmations. His solution was to write a wrapper function that replaces the confirmation queries with #’always. It’s pretty simple code and easily understandable. He binds it to a keystroke to unconditionally quit whatever function he wants to quit without the bother of confirmations.

This is yet another example of the difference between Emacs extensions and the plugins used by other editors that I wrote about previously. You almost certainly couldn’t make this change with an editor that relies on plugins.

In any event, if you’d like to get rid of some of the superfluous confirmations in your Emacs workflow, give Goykhman’s post a read.

Posted in General | Tagged | Leave a comment

Viper and Evil

Just a quick note to share something that I’m just learning after more than 15 years of using Emacs. I am, of course, aware that Viper and Evil are modes that emulate the Vi family of editors. It’s a way of letting immigrants from Vi/Vim retain their muscle memory while enjoying the superior working environment of Emacs.

I had always assumed that Viper is an older emulation that has since been replaced by Evil. That’s sort of correct but not quite precise. Over at the Emacs subreddit, CorysInTheHouse69 asks why, given that Viper is builtin, people prefer Evil over Viper. The answers surprised me.

It turns out that they actually have different aims. Viper is a Vi emulation while Evil is a Vim emulation. Unless you’re the type of person who prefers the original Vi to the “new-fangled” Vim and its siblings—and there are such folks—you probably want Evil, which offers a very faithful Vim emulation.

As a side note, several of the respondents note that the distinction between built in and third party packages is more political than practical these days. As I wrote the other day, Emacs makes no distinction between code that is built into Emacs and that which is added on. It can not, in fact, tell the difference. It is, as they say, turtles Elisp all the way down.

Regardless, if you, too, were ignorant about the different purposes of Viper and Evil, now you know.

Posted in General | Tagged | Leave a comment

Query: Disqus Markup

Does anyone know what’s going on with Disqus markup? For as long as I’ve been using Disqus for Irreal’s commenting system, I’ve been able to respond to comments with text containing simple HTML markup such as <i>some text in Italics</i>, monospace text using <code> ... </code>, a link, or even a block quote. This worked whether I wrote the text directly in the browser buffer or, as I currently do, by using emacs-everywhere.

Lately I’ve noticed that instead of being applied, the markup just appears verbatim. That is, instead of italic text, I get <i>italic text</i>. I never used the buttons that Disqus provides for such markup and, of course, that’s impossible with Emacs-everywhere.

To my mind this is a step backward. If Disqus persists in this behavior I’ll probably just use the standard Org markup for everything except links. For those, I guess I’ll just have to specify the link in text. I don’t understand the point of all this. If anyone knows what’s going on—or better yet—how to fix it, please let me know.

Lots of people don’t like Disqus but I’ve found that it serves my needs well. I don’t understand why they’d remove a useful capability for no apparent reason. In any even if you start seeing my comments with Org markup, you’ll know why.

Posted in Blogging | Tagged | Leave a comment

Rolling Your Own Syntax

Over at Abstract Heresies, Joe Marshall has a great post on one of the reasons Lisp is such a great family of Languages. I say “family” because there isn’t a single Lisp language. These days, the four main Lisps are Common Lisp, Scheme, Clojure, and Elisp although there are others. I’ve been using all but Clojure for about 20 years. Recently, I do most things in Elisp simply because it’s quick and easy to get something going in Emacs with it.

One of the main sources of Lisp’s power is that Lisp programs are defined in terms of Lisp data structures. Specifically, a Lisp program is a set of nested lists. That’s the source of the well known aphorism that in Lisp, programs are data and data are programs. Marshall’s post looks at another outcome of Lisp programs being data: macros.

Because Lisp programs are data, it’s possible, through macros, to write code at compile time that then becomes part of the program being compiled. A consequence of this is that unlike almost every other language it’s possible to add new syntax to the language. Marshall gives a couple of examples of how easy it is.

Another, less exciting example, that I used to deal with all the time was adding a while construct. One of the Lisps I mentioned above, I no longer remember which, didn’t have a while operator at the time but it was almost trivial to add it in terms of existing constructs. Try doing that in any other language. Even if it’s possible you’re going to have to modify the parser, and perhaps, the lexer and code generator as well.

This capability is why Lisp is called the programmable programming language. The fact that Emacs is written in a Lisp is why it’s fair to describe it—and only it—as a programmable programming editor.

Posted in General | Tagged , | Leave a comment