An Apostate Returns

It’s a commonplace in the Emacs community that one of the big advantages of Emacs is that all your tools are connected and work with each other. Those of us at the extreme edge of that truism make it a point to try to do everything we can in Emacs. Still, it’s mostly just something you hear repeated occasionally: there aren’t many case studies to confirm it.

Over at the Emacs subreddit, pragmat1c1 has some actual data. He was an Emacs/Org-mode user who got seduced by all the shiny applications for writing and collecting/storing information. It’s true: they are pretty nice but as pragmat1c1 discovered, they don’t work all that well together. You’ve got a set of nice tools but they aren’t integrated and it’s difficult to share information among them.

Realizing this, pragmat1c1 returned to Emacs and Org-mode and was delighted to (re)discover how well things fit together in the Emacs ecosystem. All his activities, such as writing, text editing, and task management, are connected and he can access any of them while working on any of the others. Everything just fit together.

So, it appears that all that conventional wisdom is correct. The Emacs environment really does provide a coherent framework for accomplishing all your work. So much for Emacs being a niche application with ever decreasing relevancy.
.

Posted in General | Tagged , | Leave a comment

Hints For Writing Unix Tools

Marius Eriksen has a useful post for those not afraid to leave the comfort of the GUI for the command line. It’s long been noted that the ability of Unix to compose tools into pipelines is extraordinarily powerful and makes building one-off custom commands almost trivially easy.

This composability is a feature of virtually all Unix command line tools but sometimes a specific workflow or domain requires a new tool that can’t be built up from existing ones. Eriksen’s post, Hints For Writing Unix Tools, offers some pointers for building such a tool. The main principle is too make sure the new tool composes well.

First and foremost that means reading from STDIN and writing to STDOUT. That’s the key to making it possible to use the tool in a pipeline. Two other, almost as important, principles are to avoid interactive input and to write error messages and other diagnostic output to STDERR.

There’s more, of course, so be sure to take a look at Eriksen’s post to get the whole story. I know that it’s a popular opinion among some younger developers that the command line is dinosaur land but I think there’s a good case to be made that if you can’t build command line pipelines, you’re working too hard. Once you accept that, it’s pretty clear that knowing how to build your own pipeline applications is a useful thing to know.

Posted in Programming | Tagged , | Leave a comment

Editors versus IDEs

Over at the Hacking the Grepson podcast, Mike and Matt discuss text editors versus IDEs. The podcast was at once informative and annoying. On the one hand, they discuss the difference between a text editor and an IDE.

If you’re like me, your first reaction is, “What’s the problem? Everyone knows the difference.” That works right up until someone asks you specify what that difference is. Then we mostly fall back to channeling Justice Stewart and settle for saying we can’t define it “but I know it when I see it”.

Mike and Matt have a pretty good definition: it’s an IDE if you can compile, debug, and run the code from within the application. Of course, even that’s a little squishy. Is Emacs an editor or an IDE? According to Mike and Matt’s definition, it’s an IDE. I’m fine with that but others would disagree. Everyone agrees that Nano is an editor and that Eclipse is an IDE but there are a lot of editors/IDEs in the middle.

The annoying aspect of the podcast is that Mike and Matt act as if they were born yesterday. In discussing the ED line editor, they wonder why anyone would choose such a paradigm as if they’d never heard of a teletype and were unaware of how editing was done in the days before cursor addressable terminals—including, of course, the early development of Unix as this iconic picture of Ken Thompson and Dennis Ritchie illustrates.

Even worse, from my point of view, is their dismissal of Emacs as a niche editor that has long since been eclipsed by VS Code. As I’ve said many times, I’m fine with the unenlightened preferring the bling and glitz of editors like VS Code but please don’t tell me that VS Code and other pretenders have supplanted the Emacs. The fact—as evidenced by Org-mode and Magit—is that Emacs is at the forefront of editor/IDE development. If you don’t understand and admit this then your opinions on the relative merits of editors is suspect.

Posted in General | Tagged , | Leave a comment

Invoking the *Messages* Buffer

The Emacs Command of the Day Twitter feed tells us something that I didn’t know:

That’s a really handy way of popping up the *Messages* buffer and it works even though the minibuffer is not active. Of course, you have to use the mouse to invoke it but that’s not too bad if you have a laptop with a trackpad—especially a MacBook where you can do the whole operation with your thumb while keeping your fingers on the home row.

There are many ways of popping up the *Messages* buffer—Ctrl+h e for example—but clicking on the minibuffer seems particularly easy. If you’ve taken a sacred pledge to abjure mouse usage from within Emacs, this method is obviously not for you but if you’re flexible about the mouse it’s a nice thing to know.

UPDATE [2022-04-26 Tue 13:24]: adjure → abjure

Posted in General | Tagged | Leave a comment

Org Mode 9.5.3

I somehow missed this yesterday but Bastien has announced the release of Org-mode 9.5.3. It’s a bug release so it’s probably not urgent to install it unless you’re being bitten by one of the bugs.

Bantien’s announcement notes that the next release, Org 9.5.4, will be released with Emacs 28.2.

As always, thanks to everyone involved in getting this release out to us. Org is incredibly important to my workflow and I couldn’t do most of what I do without it.

Posted in General | Tagged , | Leave a comment

Tony Aldon On Catch/Throw

Here’s another post from Tony Aldon. Sacha already covered it in Emacs News but it’s interesting enough that it deserves another mention. The post is about catch/throw and examples of its use.

Aldon starts with some simple made up examples of using the catch/throw paradigm. He shows some of the ways it can be used. Most of the variation is in specifying the symbol that names the catch block but he also shows some examples of nested catch blocks.

After the simple introductory examples, Aldon presents some real examples from the Emacs source code. They’re more complicated, of course, and involve more code than just the catch/throw but they do show catch blocks in the wild.

The main takeaway about catch/throw is that it’s a mechanism for non-local exits—the throw can even be in a separate function—and is not an error mechanism like the try/catch sequence in Python, Javascript, C#, and many other languages. Its quintessential use is to break out of loops. A nice example is a dolist loop: there’s no way to specify an exit criterion so the catch/throw mechanism is perfect for exiting the loop when some criterion is satisfied.

Posted in General | Tagged | Leave a comment

Tony Aldon: Another Wgrep Workflow

Ever since I read Abo-abo’s post on using wgrep to edit multiple files, I’ve been a huge fan of using grep to search for some regular expression in multiple file, write enable the results buffer with wgrep, make changes to the results, and save those changes back to the original files. Although there are multiple workflows to accomplish this. they all involve using one of the grep commands to search for the regexp in multiple files, modifying the grep results, and then saving the results back to the files. This is an extraordinarily powerful technique that’s easy to generalize.

Tony Aldon has a post that offers another variation on the theme. It’s basically the same except that he uses rg.el to perform the grep duties. It’s very similar to what I do except that I use counsel-rg (part of the ivy swiper package) to do the searching.

Regardless of the details, the grep/wgrep paradigm is a powerful one and definitely worth knowing. It can make a complex refactoring utterly simple. The takeaway from all the posts on the matter is that you can use whatever flavor of grep you like and just write enable the grep results buffer to make changes that are reflected back to the original files.

Posted in General | Tagged | Leave a comment

Never Say Never

Some time ago, I stopped following politics and even stopped watching the news or reading a newspaper. I’m a much happier person since I did. Still, sometimes it means that I miss something important to me.

The latest such example is on the Pink Floyd front. If you’ve been around for a while, you know I’m a huge fan and consider them to best rock band in history. Of course, the band has long since dissolved and there’s not much news to be had. Roger Waters left the band decades ago, Rick Wright is dead, and iconic guitarist David Gilmour has been adamant that he is finished with Pink Floyd and has no interest in resurrecting the band. He relented when Wright died so that he and drummer Nick Mason could do a tribute album for him. That was in 2014 and although Gilmour, Mason, and Waters are still performing, none of them has appeared as Pink Floyd.

Then the Ukraine war happened. It turns out that Gilmour’s daughter in law, artist Janina Pedan, is Ukrainian and he has two grandchildren who are half Ukrainian. He was very frustrated that there was nothing he could do to support the Ukrainians until Pedan sent him a video of Andriy Khlyvnyuk, a member of the Ukrainian band Boombox, singing an a cappella version of a Ukrainian anthem. Gilmour realized that he could put this to music and in just a couple of weeks had put something together. He called Mason, who enthusiastically signed on, and along with a couple of other long time Pink Floyd backing members recorded the song as Pink Floyd and made a video.

You can see Gilmour being interviewed on CNN about the song and watch the video itself here. All proceeds from the sale of the song are being donated to the Ukrainian relief efforts so if you’re looking for a way to help the Ukrainians and are a Pink Floyd fan, purchasing the song is an excellent way of doing so.

Posted in General | Tagged | Leave a comment

How I Spent My Summer Vacation

Well, not me: Tom Lyon. His post was actually entitled My Summer at Bell Labs and tells the story of his summer internship at the Labs. Regular readers know I’m a sucker for this type of thing so of course I have to share it.

At the end of his junior year at Princeton, he applied for a summer internship at Bell Labs. He’d done some work with moving Unix to the IBM 370 so of course he wanted to work with the Unix group. The problem was that the Unix group was primarily a research organization and weren’t very active with the intern program so Lyon just applied to the normal intern program.

In an incredible stroke of luck, Ken Thompson went to lunch with Lyon and his interviewer and learned of Lyon’s work with porting Unix to the 370. As a result, he was invited to work with Dennis Richie and Steve Johnson who were working on porting Unix to the Interdata 8/32 minicomputer. Lyon’s job was making the user programs portable.

He says that his senior year at Princeton was a disappointment to him because after his experience at the Labs, he couldn’t take his courses seriously. He said they were interfering with his education.

If like me, you enjoy reading stories about the early days of Unix and the people involved in building it, take a look at Lyon’s post. It’s fairly short and a quick read but enjoyable nonetheless.

Posted in General | Tagged , | Leave a comment

Emacs and Calibre

Garjola Dindi has a very interesting post on using Calibre from within Emacs. Dindi already read his books from within Emacs using nov.el for Epubs and pdf-tools for PDFs but because he manages his library with Calibre, he had to leave Emacs and open Calibre to handle administrative chores on his library.

Recently, he (re)discovered calibredb.el and realized that he could use it to handle those administrative tasks without leaving Emacs. Calibredb.el wants to use ebook-reader and evince to open books so Dindi had a make a simple adjustment for that. Otherwise, everything worked out of the box.

I do almost all of my reading on an iPad so this doesn’t come up for me even though I have used Calibre on my laptop in the past. I sometimes read technical books on my laptop but I usually just fire up pdf-tools directly to do it. Dindi reminded me, though, that there’s a lot of benefit to reading technical material on a laptop: it’s easy to take notes with Org-mode and to leave bookmarks or other links into the book you’re reading.

The downside is that I haven’t been very diligent about organizing my books so I always have to go searching for them. That’s exactly the problem that Calibre solves, of course, so Dindi’s post has inspired me to consider reinstalling Calibre and getting my library in shape. At least for technical books, that makes a lot of sense.

Posted in General | Tagged , | Leave a comment