Sparse Trees

Emacs Elements has a short video on sparse trees. The TL;DR is that sparse trees give you a method of filtering an Org file to show only the information that you’re interested in. The information can be random text, a tag, a property, deadlines, dates, or date ranges.

Unfortunately, the video doesn’t capture the full power of sparse trees. It makes it seem as if all it does is highlight the matches in the visible buffer but sparse trees are actually much more powerful. If you have a large file, it will hide any non-relevant data except for context. The rules for what constitutes “context” are slightly complex so you should take a look at the documentation for the full story.

My only complaint is that I can’t find a way to restore the original buffer after invoking a sparse tree filtering other than reloading or rebuilding the file. You can turn off the highlighting but I can’t figure out how to get the original buffer back. This is Emacs so I’m sure there’s a way but I haven’t found it1.

Another nice feature of sparse trees is that you can “stack them”. That is, after forming a sparse tree representation of the buffer you can refine that representation with further filtering.

The video is only 5 minutes, 12 seconds so it’s easy to find time for it. It will give you a good overview but you really need to check the documentation for the complete story.

UPDATE [2024-04-14 Sun 19:27]:

I just noticed that the fix for restoring the previous buffer state no longer works so we’re back to no solution to this problem.

Footnotes:

1

According to this Stack Overflow entry, there is no good way of doing this. One responder does give some code that appears to do the job.

Posted in General | Tagged , | Leave a comment

Left Hand Quick Commands

Emacs elements has another interesting video, this time on some commands that he’s rebound for quick invocation. Those commands are (roughly):

  • kill-buffer
  • set-mark-command (Push mark)
  • set-mark-command (Pop mark)
  • exchange-point-and-mark
  • jump-out-of-pair (A custom command)

He begins the video with some praise for the IBM Model M keyboard that he uses. I can relate. As I’ve written before, it’s the greatest keyboard every made. It’s layout is pretty standard so whatever “standard” keyboard you’re using probably has a very similar layout.

Emacs customization, of course, is all about making it as frictionless as possible for your workflow so it makes no sense to criticize someone else’s bindings but it’s interesting how different his choices are from mine.

He uses Ctrl+1, Meta+1, and Meta+2 for some of those commands. He says re realizes that theese are prefix keys but says he never uses them. I, on the other hand, use them all the time. If I want to delete 2 words, I do it with Meta+2 Meta+d. Similarly, if I want to delete 3 characters, it’s Ctrl+3 Ctrl+d. These are all burned into my muscle memory and I’d never give them up.

There’s more to his customization than just rebinding the keys. Most of the above commands also activate the mark and result in highlighting regions. That’s almost never what I want and neither does he. He has a bit of custom code to deactivate the mark so that doesn’t happen. Even if, like me, you don’t care for his rebindings, you may want to grab his code to eliminate the mark activation.

This is a short video and worth a few minutes of your time.

Posted in General | Tagged | Leave a comment

🥩 Red Meat Friday: That’s Not Vim…

Just a quickie today but it’s really, really red meat. If you’re an Emacs partisan, it will give you a reason to chuckle all day. If you worship at the Church of Vim, you’ll be less amused.

As I’ve said before, I never enlisted in the Editor wars and I certainly never took them seriously but it’s indisputable that they can be the source of fun and humor. Sometimes, as with this item, Vim takes the hit. Other times Emacs does. In either case, the trick is to think of them as humor, not tablets from Mt. Sinai.

Posted in General | Tagged , | Leave a comment

Boeing: The Past Comes Due

I was going to fold this into my last post on Boeing but as I considered how to add it to that post, I realized that I had too much to say. As I noted in the last post, I’ve become obsessed with the Boeing story. I finally realize why: I, too, have worked for companies where finance guys with no knowledge or interest in engineering where in charge.

I once had a CFO tell me that, “all programmers are fungible so I don’t have to worry about getting rid of them. I can always just hire more.” This attitude, writ large, is what’s been going at Boeing for much too long. Upper management—all of them finance people—felt free to not just consume but squander the corporation’s seed corn: the institutional knowledge, expertise, and experience of their workforce and vendors. To them, the only thing that mattered was the stock price and the only thing they were interested in was finance and how to manipulate it to raise the stock price.

Now, finally, the past has come due. As described in this Seatlle Times article, the last incident of the blown-out door plug resulted in a customer/regulatory/criminal-investigatory backlash that has shaken the company. CEO Dave Calhoun has acknowledged the inevitable and will leave by the end of the year.

What happened? As I’ve mentioned before, the company management was captured by finance suits as a result of the Clinton Administration’s forced merger with McDonald Douglas. These people were all acolytes of Jack Walsh whose leadership of GE was the stuff of legends. Until it wasn’t. GE fell apart and Walsh’s ideas began to fall in disrepute. Apparently, Boeing management didn’t get the memo and continued to burn their seed corn.

The question now is whether they can recover. I’m not optimistic but I certainly hope they can. Boeing is not just a national treasure but a worldwide one. Their planes fly all over the globe and serve airlines from every country. It would be a shame to see their demise.

Posted in General | Tagged | Leave a comment

Neal Stephenson On Emacs

All of us Emacs nerds are familiar with Neal Stephenon’s essay In the Beginning…Was the Command Line, in which he describes Emacs as the thermonuclear word processor. A couple of years ago, he did a podcast with Lex Fridman in which he expands on his remarks and comments on the longevity of Emacs.

Fridman asked him if he thought that Emacs would still be around in, say, a hundred years. Stephenon’s answer invoked the John Henry legend where in the end, Henry was unable to keep up with the steam hammer. Stephenson says that Microsoft and Apple are pouring so much money and effort into VS Code and XCode that eventually Emacs won’t be able to keep up.

I don’t think that XCode is an issue in this discussion. It’s not primarily a text editor and is, in any even, very specific to the Apple universe. VS Code, on the other hand, can certainly be said to be an Emacs competitor. I don’t think it’s as powerful or full featured as Emacs but it does have a lot of money and power behind it. Whether Microsoft itself will survive for a hundred years and if they do whether they’ll find it economically advantageous to continue supporting VS Code are open questions.

I think that technology 100 years from now will look so different from what we have today that virtually no technology we have now will be extant. That will probably include Emacs. On the other hand, Emacs has been defying the odds for a long time and may surprise us all. What do you think?

Posted in General | Tagged | Leave a comment

Boeing’s Suicide Mission

This is yet another post about Boeing and its troubles. I know I seem obsessive about this issue, and I am. It saddens me that a company known for—some would say who defined—engineering excellence has been hijacked by a pack of bean counters who care for nothing but its stock price.

Boeing’s senior management loathes experienced and competent engineers. Their CEO, Jim McNerney called them “phenomenally talented assholes” and encouraged his management team to ostracize them into leaving the company. They’ve been largely successful.

Over at The American Prospect, Maureen Tkacik has an excellent, if depressing, article on Boeing’s Suicide Mission. I challenge you to read it without becoming infuriated. The story is told from the point of view of a long time (30 years) Boeing quality manager, John Barnett. For the crime of refusing to look the other way, he was targeted and finally driven from the company.

The article claims that management had let their concern for the stock price lead them to ignoring safety concerns, covering up problems, and into actual criminality. Hundreds have died due to problems with the 737 Max but the problems are everywhere. One group of 15 Boeing line mechanics were asked if they would fly on a 787 Dreamliner. All but 5 said no.

Barnett was set to testify in a criminal inquiry concerning Boeing’s practices when he died—some would say mysteriously. His death was ruled a suicide but those who knew him are having none of that. One long term former executive, speaking of Boeing senior management, said, “I don’t think one can be cynical enough when it comes to these guys.”

Tkacik’s article is long but it’s a great read and I urge you to spend a few minutes with it. It’s saddening and infuriating to read about the suicide of a company that once defined engineering and manufacturing excellence. As Tkacik puts it, “[Boeing is] an institution that [is] in a perpetual state of unlearning all the lessons it had absorbed over a 90-year ascent to the pinnacle of global manufacturing.”

Posted in General | Tagged | Leave a comment

An Analysis Of The XZ Malware Injection Process

If you’re in tech and not in a coma, you will have at least heard of the recent attempt to inject malware through the xz (de)compression utility. The technical press, as is its wont, has been blasting the story all over the Internet. They have, of course, as is also their wont, got large parts of the story incorrect and pawned off speculation and misinterpretation as informed commentary.

Many stories stated that “unix-like” systems were affected by the exploit. Does that mean macOS users should worry? What about users of FreeBSD and the other BSD distributions? The short answer is no. Only x86-64 Linux systems are at risk.

Christian “naddy” Weisgerber is the maintainer of the archivers/xz port for OpenBSD so, of course, he was very interested in this and took a close look at the malware injection process. His TL;DR is that the injection script explicitly aborts if it’s not running on an x86-64 Linux system.

He has a long post on the openbsd-misc mailing list that details his findings. The malware author(s) went to great pains to hide what they were doing. The process proceeds in several stages with each stage removing the obscuration from the next stage. The malicious code was hidden in two “test” files that purportedly tested the decompression. These files, by themselves, seemed completely innocuous even when examined.

Weisgerber’s post is a good overview of what was going on and should interest any security nerds out there. The post doesn’t go into the low level details so it’s interesting even if your aren’t concerned with the nitty-gritty.

Posted in General | Tagged , | Leave a comment

A Deep Dive On Registers

Arialdo Martini is back with a very informative post about using registers to store buffer locations and other data. He starts with positing the need to store buffer locations by name rather than storing them in a ring buffer as he discussed in his post on the mark ring and then gives two possible implementations.

Of course, that’s not necessary because Emacs already has functions to do this. I generally use registers to store other information such as window configurations and text I need to insert repeatedly into a document but storing buffer locations can be useful.

It turns out that the Emacs implementation is much more robust than you might imagine. For example, if you close a buffer that is stored in a register and is displaying a file, Emacs will update the register to a file-query that will reload the buffer if you jump to the register containing the reference.

But it gets better. Martini shows how you can make registers persist across Emacs sessions. All of this is builtin to Emacs and available simply by invoking the requisite functions.

The only thing that Martini doesn’t mention is that the register keys aren’t stored as a single character but as a symbol reference.That means that you can name a register as a symbol (in Elisp), which makes it easy to store, say, window configurations without risking having it overwritten interactively. I use this all the time to run certain functions in full screen and then restore the previous window configuration when I’m done.

The thing about registers, as Martini says, is that they’re implemented using normal Elisp data structures that are available to end users to use in any way they see fit. It’s another example of how configurable Emacs is.

Posted in General | Tagged | Leave a comment

Writing With Emacs

This post is about another of my browsers tabs that I’ve had open seemingly forever. It’s a curated list of resources for writing with Emacs. As such, it’s a nice coda to my previous post on Emacs writing workflows.

It’s mostly a list of tips and how-tos rather than links to tools. Many of the links point to things that Irreal has covered before but there are plenty that are new to Irreal.

There are sublists for writing blogs, technical documents, screen plays, and books. There are also links for writing workflows and Emacs modes and configurations for writers. If you’re a writer, there’s a lot of good material on this site worth perusing and you should probably bookmark it for easy reference.

This site is a good demonstration of the fact that Emacs, as an editor, is useful for much more than just writing code. Lots of people, me included, use it for virtually everything we write. The same things that make it so good for editing text also make it ideal for writing prose or text of any kind. As I’ve said before, every time I write in something other than Emacs, I feel like I’m in Bizarro World where nothing works as it should.

Posted in General | Tagged | Leave a comment

An Emacs Writing Workflow

I’ve written before about Peter Prevos and his Emacs Writing Studio but here’s a bit more. I’ve had this article about the Emacs writing workflow up in my browser for a long while and decided the time had come to either write about it or delete the tab.

Prevos views writing as a five step process:

Ingestion
Reading, listening to, or watching content as a source of ideas. Emacs, of course, has extensive support for this.
Ideation
This stage involves taking notes about the content from the ingestion step. Emacs has exceptionally strong support for this with the Org package as well as other packages, such as Denote and Org Roam, to help you organize your notes. Prevos uses five types of notes that you can read about in his article.
Production
This is the step where you write your post, article, book, or whatever. It is, I think, the most enjoyable part of the process. Again, Emacs has our backs for this step. Unless you have special requirements, you almost certainly want to write your text in Org mode. The Org markup makes it easy to apply almost any formatting you’re apt to need for a writing project and the export system lets you deliver the final product in almost any format.
Publication
This is where you produce the final product. It could be a simple post, a longer magazine or journal article, or a even book. If you wrote in Org mode, you can produce a product suitable for any or all of these with the push of a button.
Communication
In this step, you tell the world about your product. Emacs has support for email, IRC, social media and other ways of communicating from inside the editor.

If you produce written output, you’ll probably recognize most of these steps even if you don’t follow Prevos’ workflow exactly. I use something vaguely resembling the first four steps but don’t do anything about communicating my daily Irreal output.

Prevos notes that his workflow is his workflow and others most likely do something different. Still, there’s some good ideas in his article that any writer can adapt for their own use.

Posted in General | Tagged | Leave a comment