Custom Functions In Org Tables

Most Org users know that there are built in functions that can do things like sum some or all of the entries in a row or column of a table. The set of functions is actually much richer than simply adding up a column’s entries. It can, in fact, be any algebraic expression understood by Emacs Calc

But wait, there’s more. If you need something not covered by the builtin functions, you can define your own. It’s actually pretty simple and worth being aware of.

525G7bKV over at the Emacs subreddit has a short post that shows how to do it. The function part is an ordinary Elisp function that can make pretty much any calculation you need. That part shouldn’t present any problem to those familiar with Elisp.

The trickier—but not by much—part is specifying how to call the function in the table’s TBLFM line. Specifying what cells to use is done as usual and the function to call is placed in a '(...) construct. Check out 525G7bKV’s post and the documentation for the details.

Given the richness of operations accepted by Calc, you wouldn’t think you’d need a custom function but it comes up occasionally for me. It is, in any event, worth knowing that the capability exists in case the need arises.

Posted in General | Tagged , | Leave a comment

Yeetube

As I’ve written many times before, the Irreal bunker strives to be Google free. We mainly succeed in that endeavor with the single exception of YouTube. It’s far and away the best in class service of its type and more importantly it has no viable alternatives.

It turns out, though, that you can lessen the pain a bit. Michał Sapka has a nice blog post reporting on Yeetube, an Emacs wrapper around YouTube that lets you play YouTube videos (via MPV). It does away with the ads, has less tracking, and allows you to download and save videos for later viewing.

In addition to doing away with the worst aspects of YouTube, it lets you deal with the videos from within Emacs. I haven’t had a chance to try it out yet and I don’t know what the video quality is like versus native YouTube but it seems like a worthwhile project. Take a look at Sapka’s post for the details.

Posted in General | Tagged | Leave a comment

A Bit More On The Silliest Emacs Meme

Last Friday, I offered up a Red Meat Friday post that discussed the silly but depressingly widely held idea that Emacs is dying. As I said in that post, this is not an idea that’s held by anyone who actually uses Emacs but appears to be an article of faith held by those unwilling to spend the effort to learn Emacs at even a journeyman level.

Bozhidar Batsov also discussed this issue recently and dismissed it as the usual nonsense that should be ignored. He even says he didn’t bother reading the reddit post that occasioned Batsov’s and my subsequent posts. He does, however, provide a bit of evidence for one of my suppositions.

I speculated that Emacs usage as a percentage of the total possible user base has declined. Take a look at the chart he provides for the evidence. The TL;DR is that while VS Code holds 73.71% of that user base, Emacs is down at 4.69%. Notice that that figure says nothing about the total number of Emacs users. It may have increased, as Batsov suggests, or it may have declined. There’s probably no way of knowing.

One thing for sure, the Emacs editor is going strong, enjoying healthy development, and is probably growing, at least in total user terms. I’d be willing to bet that Emacs will still be going strong long after VS Code has faded into same obscurity being enjoyed by all the other would-be Emacs killers.

As of this writing, no one has bothered commenting on Irreal. That’s probably because Irreal readers are smarter than the average bear and consider everything I said obvious and not in need of further discussion. It was picked up by the Emacs subreddit, however, and there are plenty of comments there if you really want to know what others are saying.

Posted in General | Tagged | Leave a comment

The Roots of Unix

While researching for my post The History of C Compilers, I came across another post from Diego Crespo that was sort of along the same lines. This one, Tracing the Lines: From the Telephone to Unix, follows the early history of Unix and how it fit into the history of the telephone system.

Almost from the beginning, Bell instituted a research organization in his new company. It was called the Volta Bureau but its mandate was remarkably similar to that of the Bell Labs that it would evolve into. This was in 1880.

Years later, Bells Labs was a third of the Multics Project—along with MIT and General Electric—but eventually realized that the enterprise was a dead end and withdrew. By now, it’s a well know story that Ken Thompson found himself with nothing to do and started playing around with an essentially forgotten PDP-7. It was there that he first programmed his Space Travel game and later started experimenting with optimizing disk access.

Eventually, he realized that he was 3 weeks away from an operating system. Serendipitously, his wife chose that time to take their young son to visit her parents in California for 3 weeks. When she returned, the first version of Unix had been born.

Most of this work was done in secret because, after Multics, Bell Labs management wanted nothing further to do with operating systems. Thompson wanted a bigger machine but couldn’t get approval. Then he convinced the patent office that was looking for a system to deal with Bell Labs patents that they should get the machine he wanted and his group would write the software for it. That was so successful that the patent office bought them an even bigger machine (a PDP-11) to work on.

What I like about this story is that like a lot of great systems, Unix was the result of an individual programmer’s itch. Thompson was bored so he invented Unix. Try to imagine what would happen if Unix had been a management inspired project. Actually, we don’t have to imagine. We need only look to Redmond.

If this type of thing interests you, take a look at Crespo’s post. It’s a good read.

Posted in General | Tagged , | Leave a comment

Describe Symbol Redux

I just came across this post from Bozhidar Batsov about describe-symbol. It’s a help command, bound to Ctrl+h o, that combines the results of describe-function and describe-variable. The putative advantage of this (newish) command is that a single key shortcut serves to get information on both functions and variables.

My first thought, when reading Batsov’s post was that the command was a real win but then I started wondering whether muscle memory would keep me using the bindings, Ctrl+h f and Ctrl+h v for describe-function and describe-variable instead. It turns out that we have an answer to that question.

As I was preparing this post, I discovered that I’d written about the describe-symbol command back in 2022. Back then, I also thought it was a good replacement but I don’t believe I’ve ever used it since. Indeed, I’d forgotten all about it. Still, if you’re new to Emacs and haven’t developed muscle memory for the old commands, it could be a win. If you’re a new user or not as set in your ways as I am, this single command is only one thing to remember instead of two.

Posted in General | Tagged | Leave a comment

Isearch Transient Menu Now On Melpa

Last year, I wrote about Charles Choi’s transient menu for isearch. The idea is that while widely used, isearch is a very complicated function with many options. Most Emacs users don’t know all those options and almost none of them know the obscure keybindings for them. Choi solved that problem by making a transient menu for isearch. Take a look at the above post or Choi’s original post for details. He’s since updated his menu to handle highlighting.

Choi’s implementation of the menu is pretty simple and he gives the source code for it in his post. Nevertheless, he’s just announced that he’s turned it into a package and put it on Melpa so if you’re interested in his solution and don’t feel comfortable dealing with Elisp, the package might be just what you need.

As I see it, there are two advantages to menus like Choi’s. First, and most obviously, they make it easy to invoke seldom used options when you need them. Also important, if not as obvious, is that the menu serves as a constant reminder that those options exist. I’m always rediscovering seldom used options that I’ve simply forgotten about because I hardly ever use them but that are just what I need for some obscure task. If I see them everyday, I’ll know they’re there even if I rarely use them.

It’s nice that Choi has made his menu available to us all and that’s it’s easy to get from Melpa.

Posted in General | Tagged | Leave a comment

The init-dir Option

Bozhidar Batsov over at Emacs Redux has a short post on the new(ish) Emacs command line option, init-dir. It does just what it sounds like: it allows you to specify where to find the init.el file and other configuration information. I remember seeing it in the release notes for Emacs 29 but didn’t think a whole lot about it.

Batsov, of course, zeroes in on an important use case: enabling you to try (or use) different configurations while keeping your main init.el intact. He uses the example of having one init file for the Prelude distribution and another for Spacemacs.

Using the option for trying different distributions makes a lot of sense because the init files and required packages differ substantially. Even those of us who happily use vanilla Emacs will find it useful for trying out experimental configurations or for refactoring our configurations.

As Bastov remarks, you can do the same thing with symlinks and, indeed, that’s just what he and I used to do but using init-dir makes things simpler and easier and is another way of sanding down your workflow. Where before I may have hesitated to go through all the steps to set up an alternative configuration, now it’s simply a matter of copying my init.el, making the necessary edits, plopping it in some directory, and pointing Emacs at it with init-dir.

It’s nice to see Batsov blogging more again. I almost always learn something new when he posts.

Posted in General | Tagged | Leave a comment

🥩 Red Meat Friday: Is Emacs Dying?

Is Emacs dying? Lordy, I get so tired of that trope. Don’t like Emacs? I’m fine with that. Sorry you’re missing out, but fine. What I’m not fine with is people who don’t like Emacs and probably have never used it seriously declaring it a spent force. To be fair, redditisinmyheart doesn’t appear to fall into that category and seems to be asking an honest question rather than making an ill informed statement but most people declaring Emacs dead don’t know what they’re talking about.

Part of the confusion for some people is the conflation of two separate issues:

  • Has development and improvement of Emacs stopped or slowed?
  • Is the user base as large as it once was. Is it growing or shrinking?

The answer to the first question is an unequivocal “No”. Org Mode, Magit, Native Compilation, Treesitter, LSP, and tons of lesser improvements are happening all the time. Lately, the Emacs developers are making major releases about once a year and smaller releases regularly. Meanwhile, all those “vibrant editors” are still trying to clone Org and Magit

I don’t have figures at hand but it’s my impression that Emacs development and the introduction of major new features has accelerated lately. Regardless, it’s clearly not the case that development has slowed or stalled.

The answer to the second question is more difficult and part of what makes this a Red Meat Friday post. Again, I don’t have figures but it’s my impression that Emacs usage as a percentage of the possible user base has shrunk. Partly, that’s because there are many more choices now, but also because the nature of the user base has changed.

It used to be—before computers were cool—that being a programmer was a calling and those who answered the call were willing and even eager to expend major effort in honing their craft. That included spending the time to master “difficult” editors like Emacs and Vi. There are still plenty of people like that, of course, but there are also a lot of people to whom it’s only a job to be gotten through with the least effort possible. Of course users in the latter group aren’t going to spend the effort to master Emacs when they can simply use VS Code instead. No steep learning curves; Just buttons to push and a lot of bling to make it look really cool.

Years before Red Meat Friday became an occasional offering here, I wrote a post that could have qualified. It posited that serious programmers use Emacs, Vim, or (on the Mac) TextMate. It got a bit of pushback but I think its point remains valid and probably speaks to why the percentage of Emacs users has shrunk.

In any event, I’m not the least worried about the imminent demise of Emacs.

Posted in General | Tagged , | Leave a comment

OSX Dictionary Interface

Here’s something that may be of interest to those of you falling in the intersection of Emacs users and Mac heads. It’s an Emacs interface to the macOS dictionary app. What it does is give you access to the macOS dictionary from within Emacs. There are two commands:

  1. osx-dictionary-search-word-at-point
  2. osx-dictionary-search-input

that look up the word at point or any word that you input. In both cases, the results are displayed in an Emacs buffer (rather than popping up a separate Mac window with the definition). Take a look at the screen shot at the link to see what it looks like.

This almost seems like a no-brainer but my dictionary needs are more than adequately met and I don’t feel the need to install this. As I’ve written many times, I have access to the famed 1913 Webster dictionary (my latest method for accessing it is here) and for quick lookups I use abo-abo’s excellent define-word. Still, if you’re using a Mac and don’t otherwise have an acceptable way of accessing a dictionary from within Emacs, this seems like an excellent solution.

Emacs really does offer us an embarrassment of riches. If you need a dictionary, there’s not just one or two solutions but many.

Posted in General | Tagged , | Leave a comment

Replacing Dash

It seems like only yesterday that Magnar Sveen introduced his Dash library for working with lists. It provided macros and functions for dealing with lists that weren’t covered by the standard Elisp library. Dash gained immediate traction and became a mainstay for Elisp developers. It’s one of those things that you use without even realizing it. So many packages install it that it’s present in almost every user’s Emacs so it’s easy to use its functions without realizing they’re from Dash.

Dash was so successful that its functions or their clones have made their way into the standard Elisp libraries. Now, Bozhidar Batsov writes that Dash has been essentially replaced by seq.el and subr-x.el and is no longer necessary.

No longer necessary except for the huge number of applications that use it. Batsov recently took over maintaining Flycheck and decided to eliminate the Dash dependencies. That turned out to be easy—almost trivial—to do. It was pretty much a one-for-one replacement of the function name.

It’s a tribute to Sveen’s vision and work that his library was so successful that the Emacs maintainers felt obligated to import its functionality into Emacs core. As a practical matter, Dash will live on if only because many of the applications that use it won’t have a Batsov to refactor them. It’s a nice library and I wouldn’t feel bad about using one of its functions today.

Posted in General | Tagged | Leave a comment