Toggling Between Let and Let*

If you aren’t an Elisp programmer—or at least some sort of Lisp programmer—this post won’t make much sense to you. If you do write in Elisp/Lisp, it tells you how to sand down a tiny bump in your workflow. It falls under the category of a small itch that you ignore until you can’t stand it anymore.

Over at the Emacs reddit, sauntcartas recounts how he always ended up needing to switch between let and let*. The difference is subtle—it concerns whether or not any of the arguments depend on any of the others—but the need to switch comes up naturally, often right in the middle of writing the code. It doesn’t take a lot of effort to navigate back to the let and add or delete the *, of course, but it does provide a bit of friction, especially if you write a lot of Lisp.

Emacs to the rescue. A tiny bit Elisp looks for the enclosing let and toggles it between the two forms. It’s a minor itch to be sure but it’s another great example of how Emacs can make your editing easier. If you write in Lisp, you really should add this bit of Elisp to your init.el. Sauntcartas’ code even reindents things if necessary.

Posted in General | Tagged , | Leave a comment

Declarative, Reproducible Emacs

Jacob Boxerman has a nice video and related blog post about his approach to configuring Emacs in a declarative and reproducible way. By “reproducible” he means that if he installs his init.el on a new system, he gets the exact same Emacs environment. That doesn’t mean just things like colors and key bindings but also that the same versions of the same packages are loaded and available.

By “declarative” he means, essentially, that he uses use-package and straight.el to specify and configure his packages in a declarative way. The goal is that the order of the declarations doesn’t matter and if one declaration s deleted, no other package is affected.

The video is a tour through a sample configuration based on Boxerman’s that shows how he accomplishes these things. The declarative part is mostly handled by use-package while the reproducible part depends mostly on straight’s ability to lock a file to a specific version. Take a look at the video and associated blog post for the details.

If, like me, you don’t have multiple machines that you require to provide exactly the same Emacs environment, you can probably omit straight.el but the idea of putting all your configuration in use-package blocks is a good one. It goes a long way towards ensuring that changes in one area won’t affect things in another.

Boxerman describes an excellent way of keeping your Emacs configuration under control and avoiding problems when—inevitably—you have to make changes. The video is only 8 minutes, 23 seconds so it’s easy to find time for it. If you find his ideas useful, take a look at his post, which explores them in a bit more detail.

Posted in General | Tagged | Leave a comment

Org Capture From Anywhere

Just a quickie today. Jack Baty has a short post on how he enables Org capture from anywhere on his system. He does pretty much what I do except that I use yequake instead of his custom script.

Yequake probably handles the edge cases but either way you simply evoke Emacs and ask it to run a bit of custom Elisp. If you aren’t doing something like this, you should take a look at Baty’s post or Alphapappa’s yequake. No matter where you are, you can bring up your capture menu and bring notes or a browser link into Emacs. I use it many times a day, especially for capturing items that I might want to write about in Irreal.

This is just another example of how Emacs can ease your workflow. You simply pop up an Emacs frame, capture you note, and deal with it later. It’s about as easy a way of capturing a quick note without breaking you out of the flow as you can get. If Emacs is at the center of your workflow, you should definitely check out Baty’s post or Alphapappa’s yequake.

Posted in General | Tagged , | Leave a comment

Remote Work: Advice From A Veteran

For reasons having to do with adverse serendipity, I’ve never been able to achieve one of my long held employment goals: remote work. For one reason or another, I’ve always ended up working for control freaks who just knew that if they couldn’t see and monitor their workers in real time they were going to goof off. That probably says more about them than those who work for them but it is a reality that can’t be ignored.

Rion Williams has been working remotely for a decade and has some advice. If you’re in a position to work remotely and suffering some anxiety you should definitely take a look at his post. The secret, he says, is balance. But the balance is a two-way street. You must balance your work flow so that you give your employer full value but maintain a separation between your work and non-work life so that you don’t burn out.

But you can’t make remote successful on your own. Your company also has to do things to make it work. Most important, of course, is giving up the micromanagement. Theoretically, that’s actually pretty easy. Companies have to start valuing and rewarding results rather than attendance. In actuality, it can be very hard for companies to make this adjustment and if they can’t, remote work is going to fail.

Given that you and your company have the proper attitude towards remote work, there are still some things to keep in mind. Take a look at Williams’ post to see what he thinks you should do to make it work.

Remote work isn’t for everyone. The smartest person I know went back to the office during the COVID-19 epidemic because he had difficulty knowing when to stop working and was afraid of burning out. He found it easier to leave the office at the end of the day than to stop working at home. But if remote work is for you, Williams’ post is worth reading.

Posted in General | Tagged | Leave a comment

No Post Today

Sorry, no post today. Life, as they say, has intervened. Not to worry, though. Everything is fine and the usual blathering will continue tomorrow.

Posted in Blogging | Tagged | Leave a comment

How Punchagan Lost His Elfeed Database

A couple of weeks ago, I wrote about how Punchagan over at NOETIC NOUGHT started saving his Elfeed database after he lost it in a system crash. At the time, Punchagan didn’t know exactly what happened, only that the system crashed and he lost his Elfeed database. He wasn’t even sure that the two events were related, only that they occurred at the same time. His solution to the problem was to set up periodic saving of his Elfeed data to git.

A little later he had some time to troubleshoot the problem and discovered what happened. The Elfeed database is basically a hash table and saving it is simply a matter of dumping the binary to a file. This happens inside a with-temp-file macro, which is much like the more familiar with-temp-buffer macro except that it saves the results to a file at the end. The saving is done with write-region, which first truncates any existing file.

What happened, apparently, is that the system crashed between the truncation of the old file and writing the new file. Sadly there’s not much that can be done at the user level other than saving the file periodically.

I liked this post because it shows how easy it is to simply follow the code—which is, of course, available whenever you’re running Emacs—to see what’s happening. Emacs, to be sure, has more sophisticated tools for debugging but often simply looking at the code will reveal what’s going on. Punchagan’s post reminds me of Sacha Chua’s post on figuring out how to edit an SVG file and its source at the same time. She figured out how to do this the same way as Punchagan solved his problem: by reading the source code to see where the undesirable behavior was happening.

Posted in General | Tagged , | Leave a comment

Exporting From Org To Docx

JR over at The Art Of Not Asking Why has a useful post on exporting an Org document to Docx. I’ve written about this before [1, 2, 3] and you might wonder why. After all, you can simply export directly from Org to ODT and get a Word compatible document.

The problem occurs when you’re working in an environment that requires a specific style implemented with a Word style sheet. The native Org exporter doesn’t support this so the usual solution is to use Pandoc, which does support a Word style sheet.

JTR’s post has a step-by-step recipe for making the conversion and setting up a Word style sheet using a reference document with the desired settings. He even covers the difficult areas of images and tables, which, of course, require further machinations.

None of this would be necessary if Word and its siblings would use plain text instead of an arcane, opaque file structure to store the document. After all, it’s certainly possible as Org—or, if you require even more complicated output, TeX/LaTeX—show. But, of course, that would stand in the way of editor lock in.

Regardless, if you have to produce Word documents but prefer to write in Org, take a look at JTR’s post. He shows you how to produce a good looking Word document from an easy to write Org file. He even shows how to automate the process using Álvaro Ramírez’s dwim-shell-command.

Posted in General | Tagged , | Leave a comment

Goodhart’s Law

Michał Poczwardowski has a nice post on Goodhart’s Law. The law is usually expressed as “When a measure becomes a target, it ceases to be a good measure.” That may seem a little abstract but its application is familiar to all of us.

My favorite example is rewarding schools or teachers for how well their students do on standardized tests. It seems like an obvious win: reward the schools and teachers who produce successful students. The problem is that that characterization is missing the part at the end that says, “as measured by standardized tests”. Of course, what actually happened is that teachers—either on their own or under direction from the school administration—started to “teach to the test”. Students didn’t actually learn more or become better students, they just became better at taking the tests. The reason I say this is my favorite example is because long ago I thought it was a great idea. Reward the good teachers and maybe even cull the bad ones. Sadly, it didn’t work out that way. Only the producers of standardized tests liked the results.

Another example is the infamous cobra effect, which, while it may be apocryphal, perfectly captures the idea. A seemingly reasonable measure for a desired result is incentivised and people find a way to maximize the measure instead of the desired goal. Very often, as with the Cobra effect, this makes the original goal worse.

Just as Goodhart says, as soon as the measure becomes the goal, people pursue it whether or not it actually helps achieve the desired result. Poczwardowski has some other modern day examples, including his own attempt to encourage engineer recruitment.

I know I’ve written about this before but it’s a lesson we forget at our peril. Take a look at Poczwardowski’s post. It’s a short and interesting read.

Posted in General | Tagged | Leave a comment

Revisiting The 500 Mile Email

Someone reposted Trey Harris’ famous story about the 500 mile email. The TL;DR is that Harris, working as a university system administrator, received a call from the Statistics Department claiming that they couldn’t send an email further than about 500 miles. If you know anything at all about how email works, your reaction would be the same as Harris’: Yeah right.

Oddly, though, it turned out to be true. It was the Statistics Department, after all, and they had all sorts of data supporting the claim. Harris ran his own tests and discovered to his astonishment that it was true. Email to a site closer than 500 miles worked fine. Those to sites further away than a little over 500 miles invariably failed.

I’ve written about this at least a couple of times before but it’s such a good story that it’s worth repeating now and then for people who haven’t heard it. The solution makes perfect sense once you know what it is but until you do it’s seems like an impossibility.

Take a look at Harris’ original post for the answer and for the amusing story. You may even learn a new way of thinking about network problems. Sometimes you need to look under the layer where the problems seems to exist to discover what’s actually going on.

Posted in General | Tagged | Leave a comment

Extracting Data From Journelly Entries

As you all know, I am always writing about how much I like and use Journelly. One of the things that I always say is that since Journelly saves it data as an Org mode file—or, if you prefer, as a Markdown file—the file is essentially a database that can be queried and processed to produce other files.

Álvaro Ramírez has a very interesting post that describes one such workflow. Much like I might do, Ramírez adds an entry in his Journelly when he comes across some data about a movie he might want to watch. It may be an IMDB entry, a Reddit post, or even just something someone told him so that all he has is the movie or director name. The common denominator is that he adds a tag such as #film or #watch to mark those entries having to do with movies he should watch. Journelly can, of course, search on the tags but Ramírez has a better way.

First he extracts all the entries having an appropriate tag into a watchlist.org file. That gives him a file with all the movies he might want to watch. He uses this and the Claude Code agent to look up each entry in IMDB and to retrieve all the metadata for each movie from IMDB and put it in a db.org file. Finally, he uses the db.org file to generate HTML so that he has a browsable file showing each movie along with its poster.

Take a look at his post for the details and to see the final results. As Ramírez says,

At the center of all it all my beloved org syntax. Thanks to plain text formats, we can easily peek at them, query them, poke at them, tweak them, and bend til our heart’s content. It’s just so versatile and now we can throw them at LLMs, too.

Almost none of this is something you’d expect a text editor to do but the Combination of Emacs and Journelly provides a way of moving from free form capture entries to a polished, browsable file.

Posted in General | Tagged , , | Leave a comment