A (Too) Short Interview With Brian Kernighan

As you all know, I’m a big fan of Brian Kernighan. He’s not only the co-author of the iconic K&R book on C but also wrote a lot of of the Unix utilities that we all depend on today. Not least among those is the AWK utility. It’s one of the premier examples of a a little language or a domain specific language.

Kernighan is a master of the genre and has generated lots of examples, big and small. Even today, he maintains and improves the original AWK. Here’s a (very) short interview with Kernighan about his developmemt of little languages.

Kernighan, in his usual self-effacing way, downplays how innovative his inventions were. He says that associative arrays, while newish, were already pretty well known and the pattern/action paradigm underlying the AWK workflow was also known if not widely used at the time. In any event, he says, yacc and lex made it all easy.

Kernighan is a treasure and one of the few remaining people who were there at the beginning of Unix and can tell us stories of what it was like. The linked interview will take you less than a minute to read and is very much worth your while. Take a minute to spend some time with one of the luminaries of our craft.

Posted in General | Tagged , | Leave a comment

Mastering Emacs (Emacs 29 Edition)

I just got a notice from Mickey that the latest version of Mastering Emacs is out. It is, when you think about it, a modern miracle. You buy a really great book on Emacs once and keep getting the new editions for free.

This version brings the book up to date as of Emacs version 29. The two megafeatures of version 29 are Tree Sitter for finally rationalizing syntax highlighting and Eglot to provide smart completion and other “modern” IDE-like functionality. But as Mickey says, there are a “million” other, smaller improvements.

Speaking of buying Mastering Emacs, Mickey is having his usual new edition sale on the book. For a little more than the next day, you can get the book for 29% off. If you have any interest at all in Emacs, you really should have this book and now is the perfect time to get it. By the time you read this, the sale will be almost over so act now if you’re interested.

Posted in General | Tagged | Leave a comment

Ready Player Mode On MELPA

A couple of week ago I wrote about Álvaro Ramírez’s ready player mode. The idea is to be able to take a quick peek at a media file from within Emacs. At the time, the app was still beta quality and not yet on MELPA.

Now, Ramírez has announced that the app is on MELPA and ready for general use. Take a look at Ramírez’s original post to see what it can do and why you might want it. Now that it’s on MELPA, it’s easy to install.

Posted in General | Tagged | Leave a comment

Casual RE-Builder Improved

I recently wrote about Casual RE Builder, one of Charles Choi’s Casual Suite apps. As I wrote then, it goes a long ways towards making RE-builder usable for those of us who can’t remember all the commands necessary to export the resulting regex to a useful place.

While he was working on Casual RE-builder, Choi discovered that sometimes—usually in the Dired subsystem—Emacs expects “grep-like” regular expressions rather than the Emacs style. This is undoubtedly because Emacs outsources certain tasks to external grep routines. The fact that the particular regexp subset used depends on what flavor of grep you have installed makes things even more complicated. If you’re like me, all of this is news to you. Somehow, I’ve managed to stumble through using Dired without realizing that it was pulling a bait-and-switch on me.

Regardless, Choi has come to the rescue. He’s changed Casual RE-builder to add an option to export the regexps from RE-builder in grep format. It’s a small thing but it makes Casual RE-builder even more useful.

I’ve already installed Casual RE-builder and presumably I’ll get Choi’s latest changes with my next update. This is, I say again, a really useful package and if you use regexps at all in Emacs, you should take a look at it.

Posted in General | Tagged | Leave a comment

A Blast From The Past: Stderr

I’ve written about this before but that was 9 years ago and it’s a great story so perhaps a reprise is due. The story is about the birth of stderr. As I wrote last time, the concept seems so natural and necessary that it’s hard to believe that it wasn’t invented at the same time as stdout but it wasn’t.

In these days of cheap laser printers that just about anyone can afford, it’s hard to comprehend how difficult and messy things were when the Unix typesetting program, troff, was written. In those days, the C/A/T typesetter—the machine that did the actual typesetting—was a washing machine sized device that was driven by a separate computer. Unlike today’s printers, the C/A/T didn’t produce finished copy. Rather it produced a film that had to be developed separately to produce a hard copy.

Given all this, those early users wanted to limit errors as much as possible so they could avoid repeating this messy and difficult process. Then one day, several users got a printout saying that such and such a file couldn’t be opened. A couple of days later, after grumbling to the appropriate people, stderr was introduced so that errors would be delivered on a different channel.

I love this story because it not only tells us the history of one of the fundamental Unix mechanisms but also gives us an idea of what the early days of computer typesetting were like.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: Roundabouts

I grew up on the South Shore of Massachusetts and as far as I knew there was only one roundabout (Massachusetts calls them rotaries) in the world. It was on Cape Code and although I never thought much about it as a child, once I started driving, approaching it always raised my stress level. I really hated it and always thought that this time I was going to get into a crash trying to maneuver through it.

As most of you know, I now live in Florida and I have discovered that roundabouts are more common than I thought. My impression is that they’re even more ubiquitous in Europe but, of course, I have no direct experience. One thing I know for sure: I don’t like them.

I am not, it appears, alone in my hatred of them. As Andy Boenau says at the link, there are few things that unite people as much as their dislike of roundabouts. Still, he says, they are the safest way of routing traffic flow through intersections. He’s got the statistics to prove it but as he says, no one wants to hear about it. They (we) are all united in our hatred of roundabouts and nothing seems able to convince us otherwise.

Traffic engineers claim that, among other things, they slow traffic down and thus make it safer than, say, intersections controlled by traffic lights. Bah! My experience has been that what actually happens is that cars speed up so that someone entering the roundabout can’t get in front of them.

None of that matters. It appears that despite near universal disapprobation, traffic engineers are intent on foisting these monstrosities on us. There is little that you or I can do to stop the madness but at least I feel better after ranting about it.

Posted in General | Tagged | Leave a comment

Learn Vim or Emacs

Kris Brandow has a (very) short video—I think it’s part of a podcast—advancing the idea that you should learn Vim or Emacs. Irreal, of course, is not going to argue with that but I wish he’d given more reasons why you should. What he does say is that you’ll discover you can be more productive with Vim or Emacs than you can with an IDE but doesn’t explain why that is. You should, he says, just try them.

One of the other people on the video objected that you don’t “just try” Emacs. It’s a commitment that takes dedication and effort to learn. That is certainly true of Emacs as we all know but it’s true of Vim as well. It’s not as hard to master as Emacs but there’s a surprising amount to know before you can consider yourself to have mastered it. That’s the problem with saying, “Just try it.” You won’t see real benefits from either editor until you’ve put a some time and effort into learning them.

The most depressing thing about the video is that Brandow described his suggestion as an “unpopular opinion”. I suppose that it might be unpopular among a certain segment of our community but there are also those who think that Javascript is a great, well thought out programming language. Ours is nothing if not a vibrant community with a diversity of opinion.

Posted in General | Tagged | Leave a comment

Gluing Emacs Features Together

Álvaro Ramírez has a very revealing post about the compounding benefits of learning a bit of Elisp. Studying how Emacs works and learning its various features pays huge dividends but, says Ramírez, learning some Elisp can compound those dividends and enable you to mold Emacs to a tool hyperspecialized to your needs.

He starts by postulating two features that you realize would be even more useful if you could somehow combine them. Then he gives a specific example. He considers the two packages symbol-overlay and multiple-cursors. The symbol-overlay package highlights all occurrences of the symbol under point in the current buffer and, of course, multiple-cursors lets you perform the same operation in multiple places at the same time.

He uses them both all the time but realized that it would be very handy if he could invoke multiple-cursors with a cursor on each occurrence of the symbol under point. He needed, in short, to combine the action of symbol-overlay and multiple-cursors.

That turns out to be fairly easy if you know some Elisp. Ramírez walks us through how he figured out how to do it and shows the Elisp that does it. There’s not a lot of code (about 20 lines), it’s easy to understand, and it serves as a great example of how a bit of Elisp can work magic. Finally, he made an animated GIF that shows it in action.

This is a nice post and it provides some code that you may find useful for your own workflow. Take a few minutes to give it a look.

Posted in General | Tagged | Leave a comment

Casual RE Builder

Charles Choi has another great addition to his Casual Suite. This time it’s an interface to the re-builder command. There are two things that everyone agrees about Emacs regular expressions:

  1. They’re very powerful and useful
  2. They have an arcane syntax and are hard to use

Well really, they’re not that much different from other RE syntaxes but there is enough difference to make using them harder than it should be. Indeed, many folks who everyone would agree are master Emacs users constantly bemoan the RE syntax and wish it were replaced with something else such as Perl Compatible REs.

Happily, there’s a tool, re-builder, that can help. I’ve written about it here and here. Unhappily, I find it really hard to use. Finding a good regexp is easy enough but it’s hard to remember how to export that regexp for use in your code or the current command.

That’s where Choi’s Casual RE-builder comes in. Like other members of the Casual Suite, when you need to remember some of the arcane commands, you can simply invoke a handy transient menu to remind you.

As much as I like re-builder, I almost never use it because I can never remember how to export the resulting regexp to where I need it. Choi’s RE-builder solves this problem and, to my mind, increases the utility of re-builder a great deal.

If you have troubles with Emacs regexs or have found re-builder too hard to use, you should take a look at Choi’s RE-builder app.

Posted in General | Tagged | Leave a comment

Relative Line Numbers

Just a quickie from something that I’ve had in the queue for a while. Chris Maiorana has a short post on relative line numbers. The idea is that the current line—the line you’re on—is considered line 0 and the lines above and below it are labeled as the number of lines away from the current line.

That’s handy if you’re interested in, say, 5 lines above or below the current line because they’re labeled as that. I love the idea but, truth to tell, I have never found a compelling use case for them. Maiorana says it handy for authors who want to know how many lines there are in the current paragraph but offers no other reason to adopt them.

Still, lots of people seem to like them and they’re certainly easy to turn on. Take a look at Maiorana’s post for the details.

Posted in General | Tagged | Leave a comment