Red Meat Friday: Another Skirmish In The Emacs/Vi War

As I’ve often said, I never enlisted in the Emacs/Vi wars. I’ve used and like them both but feel they serve distinct user requirements and aren’t really in competition. Still, that doesn’t mean I can’t appreciate the occasional volley that rises above the usual lame flaming. Here’s an example of one of the better efforts:

Doubtless Vi(m) partisans could elicit counter memes but the Emacs contingent can take comfort in the analogy offered by Baker and repeated on Twitter by Castagnetto.

Posted in General | Tagged | Leave a comment

DALL-E in Org Mode

If you follow Alvaro Ramirez’s work, you’ll soon discover that his usual procedure with a project is to start with a good idea and then keep pushing it to improve it and add new features. A case in point is his app to bring ChatGPT to Emacs.

He started with just importing the ChatGPT shell into Emacs and kept adding features. Before you knew it, he’d implemented ChatGPT as a source block type in Org mode. I thought that was pretty neat but Ramirez was not done. Now, he’s also imported DALL-E into Org mode in the same way:

I have no interest in DALL-E but lots of folks do. If you’re one of those people, this seems like a really nice way of using it as you can see from the above video.

Posted in General | Tagged , | Leave a comment

A Bit of Humor

It’s a busier day than usual for me today so this is just a quickie. I saw this post by Jason Eckert about the disparity between Apple’s hardware and their software. It’s probably not of much interest if you aren’t a Mac head but the post does have a feature that should delight you all.

That occurs at the bottom of the post’s page and, apparently, at the bottom of all pages on his site. It’s a warning, of sorts, that says

WARNING: FULL FRONTAL NERDITY

(Tech-challenged persons strongly cautioned)

It made me giggle like an 8 year old when I saw it. I hope you enjoy it too.

Posted in General | Tagged | Leave a comment

ChatGPT in Org Mode

There’s been a lot of excitement about ChatGPT lately so of course Emacs hackers have risen to the challenge with Emacs interfaces to it. The first I was aware of was Vivek Haldar’s contribution but there have been several others. One of those was by Alvaro Ramirez who has continued to work on and improve his app.

His latest addition is an Org mode interface that works from a code block. Here it is in action:

This is very neat. You simply declare a source block with a source type of chatgpt-shell and whatever you put inside is considered the prompt. In usual Org mode style you can execute the block and Org will insert the results in your buffer. A really beautiful integration of ChatGPT with Org mode!

Ramirez says that it’s still early days for the app and it’s not yet in MELPA but you can get the code from his chatgpt-shell GitHub repository.

Posted in General | Tagged , | Leave a comment

Spyware and Goodhart’s Law

Nir Eyal has an interesting article in the Harvard Business Review about the horrible, Orwellian practice of businesses using spyware to monitor what their employees are doing. Even putting aside the Stasi element, it should be clear to anyone with a functioning cerebral cortex that this a bad idea. Employee moral will plummet, the best ones will be plotting their escape, and the rest will actively subvert it to the extent they can.

Even worse, the spyware often tracks trivial things—like how many emails an employee sends—and doesn’t really tell management anything useful. And, of course, Goodhart’s law comes into play ensuring that employees will game the system so that whatever is being measured is what you will get. For example, if you measure how many emails an employee sends, you can be sure that employees will spend their time sending emails in favor of more productive work.

Rather than distrusting employees and spying on them, Eval says companies would be much better off seeking ways to not distract them. That means, among other things

  • Don’t expect them to drop everything to answer an email.
  • Don’t have unnecessary meetings, especially ones without an agenda.
  • Sync your schedules so that everyone has distraction free time to get the important work done.

Regardless, there’s a moral aspect: it’s not okay to spy on people. Even if you’re paying them.

Posted in General | Tagged | Leave a comment

Preferring Emacs Over VSCode and Vim

Ken over at the code.to.the.(moon) YouTube channel has an interesting post on Why I Prefer Emacs Over VSCode and vim. That’s a question that all Emacsers have to answer, at least implicitly. Ken’s answer turns out to be “Org mode”.

There are lots of reasons to prefer Emacs other than Org mode but Org is certainly a excellent one. As I’ve said before, a ridiculous percentage of my life is organized with Org. Many feel the same: Org is one of the top reasons that people give for adopting Emacs as their editor.

The video is not a tutorial. Rather it consists of Ken demonstrating some of the (many) things that Org can do. It by no means shows all Org’s features but it is a good teaser. It could serve as a nice introduction to yesterday’s Irreal post on getting started with Org mode.

The video is 8 minutes, 22 seconds long so it should be easy to fit in. If you’re already an Org user, it probably won’t tell you anything new but if you’re a n00b, it’s an excellent introduction into some of the things Org can do.

Posted in General | Tagged , | Leave a comment

Tracking Tax Documents With Org Mode

As I’ve written many times, I use Org mode to organize a ridiculous percentage of my life and can’t imagine living without it. It’s just so powerful that I keep finding new uses for it. The problem is, though, it’s so big and powerful that it’s hard for a n00b to get started. Experienced Org users always give the same advice: don’t try to learn it all at once; learn and use some small part of it first and then move on to another aspect of Org. Rinse and repeat.

Eric MacAdie has a slightly more refined version of that advice. As he says, “Learn X to accomplish $SOME-IMPORTANT-TASK” is much easier than just “Learn X”. This being tax season here in the U.S., he suggests learning how to use Org lists to track the receipt of tax forms.

That’s exactly how I learned Org. I started by making a check list of the W2s and 1099s that I expected to get and checked them off as they came in. When the list was complete, I could move on to the next stage of preparing my return. But that was just the first step. Later, I started tracking my tax info all year long. I had an Org table for each class of expense and added each tax deductible item to it as I went along. Each row of the table also had a link to the receipt for the item so they’re easily accessed in case of an audit. Of course, being Org tables, I also had a running total automatically. In one case, only a portion of an expense was deductible and Org could take care of that calculation automatically as well.

Finally, I had a summary table that gathered the totals from each of the tables. That table is completely populated automatically by Org as well. At the end of the year, I simply export the required tables to PDF and send them and the W2/1099 documents to my accountant. It’s still not pleasant—tax time never is—but it’s a lot easier than it used to be.

If you’re looking for a task to apply Org to and you live in a jurisdiction like the U.S. with a completely irrational and dysfunctional filing system, tracking your tax data is a good place to start.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: Neovim and Astro

Regular readers know that I was a Vi/Vim user for many years before I switched to Emacs. I liked Vim and was happy with it but when I started writing in Lisp dialects, trying Emacs seemed liked a worthwhile experiment. I was pretty quickly captured by the Lisp Machine vibe that Emacs provides and have been a devoted user since.

Still, I have always maintained that Vim is a great editor and the proper choice for those who want just an editor and not an operating environment of the type that Emacs provides. The latest iteration of Vim is Neovim, which among other things has replaced the terrible Vim extension language with Lua. I haven’t used it—Emacs devotee, remember—but it seems like a nice evolution of the Vi/Vim family.

To me, the greatest advantage of the Vi family is its composable key sequences that make learning the editing commands relatively simple. I was, therefore, a little nonplussed by this video on Neovim and Astro. If I had to summarize my impression in a single phrase it would be “bringing Doom Emacs to Vim”. The most salient feature to my mind is the substitution1 of Vim’s composable key sequences with a mishmash of Doom-like key sequences many of which aren’t even mnemonic.

The whole thing seems ill conceived. It has a lot of Emacs features but they seem poorly implemented. For example, the first part of the video involves installing Astro and involves several iterations of restarting Neovim. Emacs users don’t have to perform that dance. To channel Dennis Ritchie, if you want Doom Emacs you know where to find it.

Of course, some folks obviously like the system. You might too so take a look at the video. It’s just over 16 minutes so shouldn’t be too hard to fit in.

Footnotes:

1

Or perhaps addition would be fairer

Posted in General | Tagged , , | Leave a comment

Some Technical Details on AWK

Many of you know that I’m a big fan of AWK. After Lisp and C, it’s my go to language, especially for scripts that involve reading a bunch of lines and performing some sort of regex-mediated action on them. Its language is basically C-like but there are some anomalies that can seem mysterious.

Volodymyr Gubarkov has a project to provide an InteliJ plug in for AWK and part of that requires parsing AWK syntax so he has a good handle on those anomalies and why they exist. He discusses those peculiarities in his post, AWK technical notes.

It’s an interesting post that explains many things that you probably didn’t know about AWK. In a way, it’s getting into the weeds but it also increases your understanding of the way things work and allows you to write better AWK.

For example, one thing I didn’t know was that although it’s illegal to have a space between a user defined function and its argument list, it is legal to have a space between a built in function and its argument list. The reason for that involves string concatenation. Take a look at Gubarkov’s post for the details.

The post mentions some other interesting anomalies in the AWK syntax and the reasons for them. If you use AWK, it’s definitely worth reading the post if only to be aware of the gotchas waiting for the unwary.

Posted in General | Tagged | Leave a comment

Stacks, Heaps, and Recursion

Even before I learned Lisp, I really loved coding with recursive algorithms. When I decided to learn Lisp, I did so through Paul Graham’s ANSI Common Lisp, which meant, of course, that recursive programming became part of my programming DNA.

A significant part of my Lisp journey involved Scheme where recursion is the go to mechanism for most looping constructs. That’s because the Scheme standard mandates tail call optimization so that recursion is no more expensive in time or memory than any other looping mechanism. Not all languages or even all compilers for a given language support tail call optimization so a prejudice against recursion has emerged. The problem, according to this prejudice, is that recursion can lead to stack space exhaustion.

Tim Bradshaw examines this prejudice and dismisses it for the silliness it is. According to Bradshaw, there’s a deep-seated belief among programmers that stack space is a scarce, valuable resource while heap space is essentially free and unlimited. This leads to a preference for implementing inherently recursive procedures in an interactive way that involves managing the stack explicitly in the heap rather than using recursion and managing the stack implicitly.

As Bradshaw points out, the stack and the heap are both just memory and neither is more expensive or scarce than the other. There’s no reason to restrict stack space while allowing large heap spaces other than convention and it’s time for us to reexamine this prejudice. It’s hard to argue; Bradshaw has a point.

Posted in General | Tagged | Leave a comment