Setting Global Keybindings

Emacs Elements has a nice video on how to set global keybindings. On the one hand, it seems elementary but there are plenty of wrinkles that many users are only dimly aware of. The video notes that there are many ways of specifying the key sequence for a binding. Many of them are there merely for backwards comparability and Emacs Elements recommends that you stick with the kbd function to convert easy-to-read key sequences into the appropriate internal format.

Still, if you’re like most folks, you have a mixture of methods. They all work and there’s no problem intermixing them so you can use whatever is most comfortable for you. The video describes the kbd method as a list, which is technically true, but it’s actually a function call to a function called “kbd”.

One of the things I learned from the video is that you can assign compound key bindings easily. For example, you can simply bind function-abc to <F7> a and function-xyz to <F7> b in the normal way. I always assumed that you needed to create a key map bound to <F7> to do this but, as the video shows, it’s much simpler.

The video is centered around using global-set-key for all this but as one of the commenters notes, as of Emacs 29 that has been deprecated in favor of keymap-global-set. The new functions appear to be merely a renaming for consistency so you needn’t rush to change your existing configurations.

Most Emacs users probably know most of the material in the video but it’s worth watching in case you can learn something new. I did and I’m 16 years or more into Emacs.

Posted in General | Tagged | Leave a comment

Org-side-tree

Grant Rosson has an announcement on reddit about his new package org-side-tree. The idea is that you can have a sidebar that lists all the headings in an Org file. That doesn’t sound too exciting but you can use the sidebar to navigate to headings within the Org file. Similarly, changes to headings in the Org file are reflected in the sidebar listing.

This may or may not seem useful to you but I’ve seen lots of writers who wanted exactly this capability for their writing projects. I think (but I’m not sure) that it’s something that Schrivener offers and is one of the most wished-for capabilities by those using Org mode for writing. It makes it easy to navigate between chapters and scenes in a novel or other long form piece.

Rosson has a video that demonstates the use of org-side-tree and its capabilities. It’s worth watching. There are a lot nuances involved with its operation that make navigating a large Org file easy and pleasant.

I don’t (currently) have any Org files that I need to traverse. Usually it’s just a matter of adding some text at the end but if I were working on a novel or long paper, I would definitely use this package. Take a look at the video and see what you think. The video is 6 minutes, 21 seconds so it such be easy to fit in.

Org-side-tree is not yet in Melpa but presumably it will appear there once it gets some traction.

Posted in General | Tagged , | Leave a comment

🥩 Red Meat Friday: A Case For Journalists

In a previous Red Meat Friday post, Irreal pondered whether politicians or journalists are the least respectable profession. It’s still an open question and while most people would probably declare politicians the winners, John Gruber has a post that provides compelling evidence for journalists.

Gruber’s post is a scathing takedown of a Wall Street Journal article entitled Inside Apple’s Spectacular Failure to Build a Key Part for Its New iPhones. The article is pay walled but Gruber’s post tells you all you need to know.

The article is about Apple’s “failure” to have their own 5G modem for the iPhone ready in time for the iPhone 15. The article claims Apple was still testing their modem just months ago. Anyone who knows anything about the Apple manufacturing pipeline, knows that that’s nonsense. Hardware for Apple products are set years in advance, not developed at the last minute.

The journal article has plenty of other nonsense, too. Read Gruber’s post for the details but there are a couple observations that even Irreal can make. First, this is the Wall Street Journal, not some sketchy NetZine. The Journal is arguably the best and most reliable paper in the country and there’s really no excuse for shoddy work like this.

Second, Gruber makes the case that the article is not just wrong but deliberately so. It is, he says, an obvious hit piece with conclusions so silly that no sensible person would accept them.

You all know that Irreal is an Apple shop but this is not fanboyism. It’s not even about Apple. It’s about a serious paper abandoning journalistic excellence and perhaps even ethics. Politicians should be worried: they have some serious competition.

Posted in General | Tagged | Leave a comment

Cybernetic Productivity and Emacs

Victor Dorneanu has an interesting post on Cybernetic Productivity and Emacs. Like Dorneanu, I was unfamiliar with the term but it has, apparently, been around since the early 2000s. It’s a strategy for dealing with your workload in the digital age. The TL;DR is summed up by its four principals:

  1. Automate and Speedup shallow tasks.
  2. Keep the information you need at your fingertips.
  3. Remove friction from communication.
  4. Simplify the extraction of actionable information from raw data

Dorneanu notes that he learned all this from Cal Newport, whose work he follows fairly closely. Newport, though, says the cybernetic productivity approach doesn’t work because, if I understand his argument, we’re too overwhelmed with work to have time to follow the principals.

Dorneanu disagrees and offers his use of Emacs as a counterargument. His post details how he used the four principals—except, maybe, the communication part—to write and publish his current post. The important part is that he did it all within the unified environment of Emacs. He lets Emacs handle the routine parts of publishing a post and uses Elfeed to easily retrieve the necessary required information.

Finally, he notes that the recent integration of Emacs with the various AI/ML services provides a very nice and efficient way of sifting through data looking for the wheat among the chaff. I’d judge that more promise than fact right now but I do take his point.

Posted in General | Tagged | Leave a comment

Using Gnuplot With Org Mode Tables

James Dyer has an interesting post on using Gnuplot to plot data from Org tables. Gnuplot is my go to utility for plotting data but its syntax is, to put it mildly, convoluted and since I don’t use it all that often, it’s always a struggle to get a working graph. Dyer’s method seems less complicated—at least for simple cases—so it’s worth taking note of how he did it.

This post is mainly a note to myself but other occasional Gnuplot users who want to produce graphs from the data in an Org table may find it useful too. The TL;DR is that you specify a #+PLOT: line for the table that lists the parameters for the graph you wish to plot.

As Dyer illustrates, you can also easily produce a bar plot within the table itself with the orgtbl-ascii-draw command. It’s use is pretty much self explanatory from Dyer’s post but it’s also documented at the #+PLOT link.

Dyer’s post is short but has a surprisingly useful kernel. It’s definitely worth taking a look at it if you ever need to plot data contained in an Org table.

Posted in General | Tagged , | Leave a comment

Periodic Reminder: Emacs Bindings in macOS

Once again, as is occasionally the happens, I’ve stumbled across an Emacs user who discovered that some Emacs keybindings work in macOS. This user, sudeenhux, realized that he could navigate in the Apple Mail app with the normal Emacs bindings. He had no idea what was going on and took to reddit to ask what he had done to enable this. When reddit told him this was built in to macOS and worked with all macOS applications, he was overjoyed.

The thing is, of course, that what sudeenhux discovered is only half the story. As I’ve reported many times before—most recently here—macOS lets you configure your own bindings for its navigation commands. That would be a pain if you had to do it piecemeal but the way it works is that you put the bindings in a file and everything happens automatically. Even better, someone has already done the hard part and produced the file so all you have to do is download it and install it in the proper place. All the details are in the above link.

As a bonus, I recently got tired of not having Ctrl+Delete work in all macOS apps so I added an entry to enable it. That shows how easy it is to add your own bindings, assuming, of course, that macOS has a command that supports it.

I’m always surprised that so many people don’t know this so I like to remind everyone once in a while. Some of you may be tired of hearing about it but to those who don’t already know, it’s a revelation.

Posted in General | Tagged | Leave a comment

Navigating In View Mode

Emacs view mode is one of things that might seem superfluous at first glance. After all, you can always just visit a file and use the normal navigation commands to view the file. But there’s a lot to be said for a read-only file viewer—think less, more, or other pager utilities—that let’s you page through the file without worrying about accidentally introducing a change.

The normal view mode protocol is to use Space and Delete to scroll forward and backward like Ctrl+v and Meta+v do. It’s a nice and convenient way of viewing a file that you don’t want to edit.

Charles Choi agrees with all that but wants a richer protocol. For instance, if he’s in an Org file, he’d like the movement to be forward and backward to the next heading. Once you make that leap, you realize that other file types could also benefit from specialized navigation commands. He has a post that explores the idea of file type naviation in view mode.

He presents some code to do this for several file types and it would be no problem to add other file types as well. Even if you don’t know Elisp, it would be easy to follow the cases he presents to add your own.

View mode is an underused feature of Emacs and Choi’s enhancements make it even better. Take a look at his post and see if you don’t agree.

Posted in General | Tagged | Leave a comment

New AWK Book

Long time Irreal readers know that I’m a fan of the AWK language. Whatever OS you’re using, AWK is sure to be available. It’s installed by default on all Unix/Linux systems and may be on Windows as well. Linux systems probably use gawk by default but even it’s usually linked to awk. There is, in any event, at least one version for your system.

A year ago, I wrote about a Brailsford & Kernighan video where they talk about AWK and how Kernighan was updating it to support Unicode [1, 2]. Kernighan mentioned that as part of that effort he was updating the AWK book. The original book was written 1988 and while you can still get it, the price is exorbitant. Now that work is completed and the new book will be released on 2023-10-01. That’s good news for younger engineers who don’t have $100 to spend on the original.

I haven’t seen the new book, of course, but the original was excellent. Towards the front of the book they had a series of AWK one-liners that performed all sorts of useful tasks. Kernighan has said that he, Aho, and Weinberger had imagined that that was the way the utility would mostly be used but it’s been used for all sorts of more complicated programs, often by Kernighan himself. You can see some of those at the book link above.

I think it’s wonderful that AWK, a program dating from the 1970s, is still under development and that there’s a brand new book documenting it and its use.

Posted in General | Tagged | Leave a comment

Batch Mode

If you’re an even moderately experienced Emacs user, you probably know about batch mode. You can write a file with some Emacs commands and run it either by calling Emacs on the command line with a --script parameter pointing to the file or by adding at #! line to the top of the script and running it by calling the script directly.

Emacs Elements has a short video on batch mode that describes a use case I hadn’t seen before. The video is only 5 minutes, 45 seconds so you can watch it to get the details but the TL;DR is that you can use batch mode to check a changed init.el file for errors.

The idea is that you use batch mode to load the modified init.el file. If there are any errors, you get notified but your active Emacs instance is still operable. It’s preferable to just restarting Emacs because if there’s a disabling error, you still have a working Emacs to correct it. Sure, you could always restart Emacs with a -q or -Q option but then you don’t really have a fully operational Emacs to work with. That happens to me a lot when I have an error in my init.el. I can get by, of course, but it’s a pain. With Emacs Elements’ method you still have your familiar and comfortable working environment available.

Posted in General | Tagged | Leave a comment

Live In Emacs Or Die

Today, we have a bit of humor that we can all relate to. Reddit has a post announcing the Web browser NYXT inspired by Emacs. I don’t know anything about NXYT but I did love this comment from noooit:

Comment
byu/evlogii from discussion
inemacs

Those of us who live in Emacs will relate. The rest of the universe will wonder what in the world we’re talking about.

UPDATE [2023-09-23 Sat 15:04]: NXYT → NYXT.

Posted in General | Tagged , | Leave a comment