Casual Avy

I’ve written many, many times about how Avy is one of my favorite packages. Probably 90 per cent of my Emacs navigation is done with Avy. As I’ve said before, you can think of Avy as a generalization Steve Yegge’s recommendation to use search for navigation. Yegge’s idea revolutionized the way I navigate around a buffer and Avy refines that idea and makes it even more useful. As I’ve also said before, if you aren’t using Avy, you’re working too hard.

Now Charles Choi has stepped up to make it even better with Casual Avy. Like his other Casual packages, Casual Avy provides a transient menu to the functions that Avy provides. That’s important because Avy provides too many of them to remember.

Until Casual Avy, most of us solved that problem by restricting our use to one or two of those functions. In my case that’s avy-goto-word-1 and avy-goto-char-timer. Some, like Karthik settle for just avy-goto-char-timer. After reading Karthik’s post I’ve been using avy-goto-char-timer more but I hardly ever use any of the Avy commands except those two.

In a sense, Casual Avy gives you the bet of both worlds. You can still use mainly one or two of the commands but have instant access to all of them at the cost of a single additional keystroke.

I’m really enjoying Choi’s Casual packages. They give you access to all sorts of arcane commands without having to remember a lot of little used keystroke shortcuts. Most of the time, you won’t need them and that’s the point: you don’t have to remember a lot of shortcuts but still have access to the commands you seldom use.

Posted in General | Tagged | Leave a comment

Emacs and ATC

The “ATC” in the title is Air Traffic Control. You might wonder what Emacs has to do with air traffic control other than some engineer writing code for the system with Emacs. The truth is much stranger and surprising.

For a brief period of time, the Air Traffic Control system of the newly unified East and West Germany was running on Emacs. No, really. The German ATC system was running on an editor. The words don’t even seem to make sense.

I’ve heard this story before, but someone just posted a link to the story on the Emacs Wiki. As far as I can tell, I haven’t written about it before so I thought I’d share. The TL;DR is that after reunification, there was a huge project to combine the two countries’ ATC systems. An academic refugee from Symbolics was tasked to write the message router but didn’t know any languages other than Lisp. Being a “Herr Doktor” his word was unassailable but there was no Lisp on the system and no budget to buy one. There was, however, Emacs so Herr Doktor coded his message router in Elisp and for a little while airplanes over Germany were being controlled with the help of code running on Emacs. Proof that, as I always say, Emacs really is a Lisp Machine

It’s a truly amazing, not to say terrifying, story but the next time some VS Code partisan starts telling you how much better his editor is, ask him if it ever ran an ATC system.

Posted in General | Tagged | Leave a comment

The Origins of Unix and C

F/OSS Comics has a cute cartoon about the origins of Unix and C. If you want a quick précis of the Unix and C histories, this is a good starting point. There are a lot of inaccuracies—at least as I understand that history—but it’s still a good general summary.

By now, most everyone knows the outline of the story. AT&T, MIT, and GE teamed up to develop the Multics system. The project had a lot of good ideas but soon became ensnarled in the complexities of an increasingly complicated system that showed no signs of being completed before the need for it expired. Finally, AT&T management—not Thompson who was, after all, a worker bee engineer—decided the project was a dead end and withdrew from it.

An important part of the story is that AT&T management felt burnt by Multics and had no appetite for another OS project. The AT&T Multics refugees, meanwhile, missed the programmer friendly environment that Multics provided.

Thompson, in an extraordinarily serendipitous discovery, found an unused PDP-7 that everyone had forgotten about and began trying some of his idea on it. One day, he realized he was close to an OS and, again serendipitously, his wife took their son to the West cost to visit her parents. That gave him 3 weeks to come up with what would later become Unix. Because of management’s trepidation’s, the work was essentially a skunkworks project.
Other engineers from CSRC became interested and joined in. It was Brian Kernighan who coined the name Unix as a play on Multics. Unix had a huge number of breakthrough ideas but one of the most important, in the end, was writing the system in a high(er) level language that made it possible for it to be ported to other machines relatively easy. That language was, of course, Ritchie’s C, an extension of the B language.

The F/OSS Comics cartoon captures most of this history pretty well and is worth taking a look at.

Posted in General | Tagged , | Leave a comment

Simplifying the Use of the Repeat Command

Emacs Elements has a new video up. This one is about simplifying—perhaps “rationalizing” is a better word—the Emacs repeat commands. Those of you familiar with Vi(m) know that one of its nice features is a simple repeat command bound to the period key. Once it finds its way into your muscle memory, it’s surprising useful.

Sadly, Emacs’ repeat command(s) are a bit more difficult and not as useful. Still, they can be handy on occasion but, as Emacs Elements notes, they are bound to keys that can charitably be described as “arcane”.

One of the problems with Emacs repeat is that there’s not one but two commands: the simple repeat and the complex repeat. What distinguishes one from the other has always seemed a bit murky to me but Emacs Elements explains it well: if the command requires using the minibuffer, it’s a complex repeat. Otherwise it’s a simple repeat.

Emacs Elements rebinds the simple repeat command to Ctrl+., which is similar to Vim’s, and the complex repeat to Ctrl+z. Those bindings are simple to remember and make Emacs’ repeat commands worth getting used to.

I can see it being useful for repeating commands such as “delete 5 chars” when you want to delete a bunch a bunch of text but aren’t sure how many characters need to be deleted. Regardless, if you think you might find the repeat commands useful, it’s definitely worth your while to rebind them to something simple that doesn’t require multiple keystrokes.

Posted in General | Tagged | Leave a comment

Full Screen Time and Date Revisited

The other day, I wrote about a way to put the time and date on the modeline when Emacs is in full screen mode. The reason I cared was because full screen mode hid all the date widgets and I had to move the cursor to the top or bottom of the screen to see the date. Or so I thought.

Summer Emacs responded that she also ran Emacs in full screen but the macOS menu bar—with the date/time widget—was displayed. After a bit of back and forth, Summer Emacs discovered what was going on. It turns out macOS has a setting that controls when and if the menu bar is displayed. The default, apparently, is to hide the menu bar only when an application is in full screen mode. You can change that to never hide it. I did that and now I can see the date in both Emacs and my browser.

Yes, that means that I have one less line of screen real estate but that’s a price I’m willing to pay. Now I can always see the date and time just by looking. I’m calling it a win.

I was going to let this play out in the comments. It is, after all, a niche issue and one restricted to Mac users. Still, most readers never see the comments unless they’re commenting themselves and I thought this was helpful enough to make sure that everyone who cared saw it.

Update [2024-05-25 Sat 17:21]: he → she (clarifying that Summer Emacs is a she, not a he).

Posted in General | Tagged | Leave a comment

If Only

Joe Marshall has an X little post on Lisp. I used X because I’m not sure of the correct adjective to use. Maybe “snarky”, maybe “cute”, maybe “enlightening”, maybe “interesting”. The idea of the post is that if you find yourself wanting some missing capability when writing in Lisp you can, in fact, simply add it. In other words, you can make Lisp into whatever language you need it do be.

Everybody knows that, of course, but it got me thinking that the same thing applies to Emacs. If it doesn’t do something you want or it doesn’t do it in the exact way that you want, it’s easy to make it do so.

Sure, you probably have to know Elisp to make a lot of the changes but despite what some folks tell you, it’s not that hard to learn Elisp. It’s mostly a matter of learning the API, not Lisp itself. Once you do learn it, you have an infinitely malleable editor at your disposal. Are there some upfront costs? Sure but they’re worth it and once you get past them you have an editor that can be made to do almost anything you can imagine.

Others have already embraced this possibility and now we can read and send email, listen to music, follow RSS, and a host of other things from within the comfort of Emacs. Just as Lisp is the programmable programming language, Emacs is the programmable editor.

Posted in General | Tagged | Leave a comment

Readability And The Bureaucratization Of Google

For a long time—in the early days—I thought of Google as the spiritual heir of the CSRC from Bell Labs. After all, Ken Thompson, Rob Pike, Russ Cox, and probably others landed there. And Google was doing some first rate research and developing great software. They were a commercial enterprise, of course, and unlike Bell Labs didn’t have monopoly income to subsidize that research but they still produced some great results.

Now, of course, Google is just another giant corporation chasing growth and ever increasing stock prices and is even, arguably, a dying enterprise. As Paul Graham noted Google has become bureaucratized and can no longer ship anything. If you want to see how far “professional managers” have managed to drag Google from its founding principles, take a look at this post from Joe Marshall.

In it, Marshall discusses Google’s code readability program. It’s not quite what you probably imagine. It’s concerned with ensuring the readability of Google’s code base, yes, but not in the way you might think. At Google, you can’t check in your code unless you have “readability” or have it signed off by someone who does. That doesn’t sound too bad but as Marshall relates, it has devolved into a social signal that a readability holder is a member of the in group.

Take a look at Marshall’s post for the harrowing details. To me, it seems like exactly what you’d expect to see when the suits decide to concern themselves with what’s going on in engineering. It also seems like an unmistakable indicator of corporate decline.

Posted in General | Tagged | Leave a comment

Time And Date On A Full Screen Emacs

I run Emacs and my browser in full screen and I spend almost all my screen time in those two applications. That presents a (very) small problem: If I want to know the date, I have move the cursor to the bottom or top of the screen to reveal one or another date widget. That’s not very handy and, even worse, involves using the mouse. It’s one of those tiny problems that I’ve learned to live with.

Until today. Bram, over at the Emacs Mastadon, showed us a bit of code that displays the time in the modeline if Emacs is in full screen mode. It uses display-time-mode to do this. I toggled it on to see what it looked like. It only showed the time but I was pretty sure I could make a quick hack to have it add the date.

Then I remembered that this was Emacs and someone else must surely have thought of that so I checked the documentation. Sure enough, if you set the variable display-time-day-and-date to t, it will also display the date. Now when I need to know the date, it’s right there on the modeline.

That doesn’t solve the problem when I’m in the browser. Sadly, there doesn’t appear to be a Safari widget that displays the date but I’m no worse off than I was before when I’m in Safari and the problem had disappeared when I’m in Emacs.

Chipping away at small problems, mostly by tweaking Emacs: it is, as I’ve written previously, like maintaining a Japanese garden. A work always in progress but never completed.

Posted in General | Tagged | Leave a comment

An EMMS Transient

Sven Seebeck has taken inspiration from Charles Choi and implemented a transient to ease one of his frequent operations. That task was playing music with EMMS. His needs, he says, are pretty vanilla. He typically just wants to play an album or perhaps a specific track from an album. He’s not concerned with playlists.

He cleverly let Dired do most of the heavy lifting. by opening a Dired buffer to his music repository, he get a listing of the albums and by selecting an album, the songs in it. The rest is pretty simple as you can see by looking at his code. It’s very easy to follow and understand.

The point here is not to highlight yet another transient menu: they’re simple enough that anyone can write one simply by following, say, Seebeck’s example. Rather, the point is, once, again, how the flexibility of Emacs allows you to do this sort of thing quickly and easily.

Posted in General | Tagged | Leave a comment

Wagging The Dog

The world has gone mad. When I was a young programmer™, we strived to adjust our programs to reflect reality. If there was a mismatch, there was no doubt where the fault lay: the model was wrong and needed to be fixed.

That idea is so last year. Now, apparently, if your program’s model doesn’t match reality, it’s reality’s fault and reality, not the program, needs to be fixed.

At this point, you’re probably asking yourself what the cause of all this crazy talk is. It’s this. The North Yorkshire Council (in the UK) has decided that street signs, such as “St. Mary’s Walk”, would no longer have apostrophes and perhaps not even the period after “St”. Why? Because it confuses the computers.

If you want to argue that the period after an abbreviation is an anachronism, I’m open to that debate. In my personal notes and logs, I never use them and I write “ten thirty” as 1030 not 10:30. So my objection to the North Yorkshire Council’s plan is not some longing for ye olde grammar. It’s the idea that real people and their artifacts should change just because the people they have programming their computers are too incompetent to deal with things like apostrophes.

Yes, yes. I know all about Little Bobby Tables and the incomprehensible fact that these attacks are still not only possible but endemic. But the fact is, these problems are the programmer’s fault. We do, after all, know how to sanitize input to databases. But gee, that’s boring, and as I said, so last year. Easier to just change reality.

And let’s not even get into the problems arising from letting politicians address technical problems. That never ends well.

Posted in General | Tagged | Leave a comment