Writing With Doom

Recently, some one posted a link to this post about using Emacs for writing. It was written by Mediapthatic in 2022 but still very useful and up to date. It takes the point of view of a book writer but is equally applicable to any type of writing.

The post assumes you’re using Doom Emacs and Evil but that manifests mainly in the key shortcuts used to invoke the various commands. It mostly uses vanilla Emacs (including Org) but also depends on Avy for a lot of its functionality. There are some other packages but they play fairly minor rolls.

The real value of the piece is the workflow and strategy that Mediapthatic uses to organize his books. It’s very Org-centric. The obvious benefit of Org is the outlining and the ability to easily move headlined sections around. But there’s more. You can use tags to control export, track characters and their characteristics, and other useful things. Take a look at the post for the details.

Another advantage to Org for some writers is folding. It allows you to essentially disappear all the text except for that portion you’re working on. Mediapthatic also shows a bit of code that opens a new window with the file narrowed to the Org subtree that the point is in.

There’s some other useful information and a bunch of links to other resources so if you’re interested in using Emacs for writing prose, take a look at Mediapthatic’s post.

Posted in General | Tagged | Leave a comment

🥩 Red Meat Friday: Where Should Your Configuration Live?

When I started using Emacs, just about everybody stored their configuration in ~/.emacs. Then it seemed as if folks were using ~/.emacs.d/init.el instead. For a long time when I was writing about Emacs configurations I would write something along the lines of “your .emac or init.el”.

Now, apparently, some Johnie’s come lately are putting their configuration in ~/.config/emacs/init.el. These neo-configurators are insisting that theirs is the one true way. Some of us are demurring. What do you think?

Posted in General | Tagged , | Leave a comment

Deleting Extraneous Spaces In Emacs

Charles Choi has a nice post that reminded me about something I know but never take advantage of: the Emacs cycle-spacing command. As Choi points out, we often find there are additional spaces in our text that we want to delete. That’s not hard. You just navigate to where the extra spaces are and use Back Space or Ctrl+d to delete the unneeded spaces.

Still, that seems like a lot of bother to us Emacsers who are always on the lookout for ways to reduce our work and keystrokes. An easy way to reduce keystrokes for deleting the extra spaces is the cycle-spacing command that will, on consecutive invocations,

  • Replace all spaces with a single space
  • Remove all spaces
  • Restore the original spacing

Even given a simple keybinding for cycle-spacing that’s almost always too much work because—at least in my experience—there is usually only a single space to be deleted. For me, the real value of Choi’s post is his offhand remark that Avy makes it easy to navigate to the excess spaces.

Choi doesn’t elaborate but I assume he means something along the lines of using avy-goto-char-timer with two spaces as the argument. Since I have avy-goto-char-timer bound to Hyper+s, it’s really fast to get the target area. Doubtless, those of you using Helm or some other navigation aid have a similar command to get you to the right place.

If you often find yourself with more than one extra spaces, cycle-spacing may be worth internalizing. Even if you only have a single extra space, it may be worth writing a little Elisp to search for the extra spaces and delete them with cycle-spacing.

Posted in General | Tagged | Leave a comment

Happy New Years

It’s New Year’s Eve and I’m trying to put together a post for tomorrow. For reasons that I’m sure have nothing to do with Champagne, I’m having a bit of difficulty so I’ll just wish all of you a Happy New Year. I hope that the new year will bring all of us peace, happiness, and prosperity.

Posted in General | Leave a comment

Emacs Only Static Blog Site

Every Irreal reader who’s paying even a little attention knows that this site is WordPress based. It’s been that way since 2011, and I’m pretty satisfied with it as a blogging platform. Still, it would be nice to have a bit more control and not have to suffer the occasional WordPress vagary.

The thing is, most of the static site solutions involve something like Hugo, which, as far as I know, is an excellent piece of software but is just another thing that I don’t have control over and doubtless comes with its own set of problems.

James Dyer is a Hugo user but, like me, would like to have a process that is completely Emacs centric. Therefore, he has been running an experiment in using Org-publish as the basis of his blog publishing workflow without depending on any external software. Right now, he’s considering this a backup to his Hugo-based system and his workflow includes importing the posts from the Hugo workflow to the Org-publish one. If the experiment is a success, he will be able to replace his Hugo workflow to one that is entirely Emacs based.

If you’re interested in having a static blog site, take a look at Dyer’s post for some good ideas for a starting point. Emacs really can handle the whole process as Dyer shows.

Posted in General | Tagged | Leave a comment

Crossword Construction

I’ve been doing crosswords (American style) for most of my life but one thing I’ve never understood is how one goes about constructing them. It really is a hard problem when you think about it. Forget about clues and all that. Even forget about generating the grid. How do you go about laying down words so that you get valid words both across and down?

A useful strategy for most Irreal readers is to change the question slightly to, “how would I generate a crossword with a program?” The answer is probably going to differ from what traditional constructors have done but at least it leads us to a solution.

Bill Moorier has long considered this problem and has a post that gives an overview. The TL;DR is that once he has a grid and a list of words and clues, he uses a backtracking search to fill in the grid.

Moorier’s post outlines a complete solution that includes generating the grid, filling in the words, and, with some post processing, fixing things like using the target word in the clue. I’m not so interested in that as in simply generating a filled in grid. Making up the clues is more of an art form as evidenced by the fact professional constructors generally rely on editors to provide—or at least tweak—the clues. I don’t know how good I’d be with that but I least I understand it.

The post doesn’t provide code or even a detailed algorithm for solving the problem but it does suggest some ways to proceed. If you’re interested in crossword construction, take a look at the post. It’s a short read and worthwhile for those with even a passing interest.

Posted in General | Tagged | Leave a comment

Switching Bewteen HTML and Text In Mu4e

Anyone who’s been reading Irreal for a while knows that I’m a huge fan of Mu/Mu4e for dealing with my email. It has just the right features for my preferred workflow. That includes it’s robust search capabilities that allow me to store all my emails in a single repository and find them easily. That saves me a lot of time and mental cycles trying to decide where to store saved emails: they all go to the same place.

Another thing I like about mu4e is that it’s text based. Who, after all, wants their emails running arbitrary Javascript? Most people apparently. The majority of the email I get that’s not from fellow nerds is HTML based and often includes some sort of Javascript. I hate this but I deal with it very successfully by using the built-in view-in-xwidget command so that I can read HTML emails as they were composed (complete with the Javascript).

Hong Xu has a nice post that shows us how to move in the other direction. Mu4e will try—with various degrees of success—to display HTML by default but it doesn’t use XWidgets and the results are often less than optimal. Xu’s post describes how to make mu4e switch between HTML and plain text display for those occasions when the HTML display is distracting.

The change is simply the setting of a keymap entry for the mu4e-view-mode-map so it’s easy to add to your configuration without a lot of bother. Xu’s change along with compiling in the XWidget support gives you fine control over the way an email is displayed.

Posted in General | Tagged | Leave a comment

PSA: The GPG/Emacs Interaction Bug Is Fixed

I’m probably the last person on earth to know this but the longstanding bug between GPG and Emacs where Emacs could not open a GPG encrypted file has been fixed. Indeed, it was fixed in GPG 2.4.4 back in January.

I learned this today after spending a couple of hours trying to figure out why I could not longer send an email with mu4e. The problem was that Emacs could not open .authinfo. It took a while but then I remembered that I’d accidentally updated all my brew installed programs, GPG included. Sigh. Fortunately, I had put the recipe for downgrading to GPG 2.4.0 in my journal and just needed to downgrade GPG yet again.

If only life were that easy. GPG 2.4.0 wouldn’t build because of a missing library that was no longer available in Github. I did have it installed but for some reason the brew script couldn’t find it. During all this pain, I deleted GPG and reinstalled it with GPG 2.4.7. Suddenly, everything started working again. After a little research, I discovered that this had been fixed 11 months ago.

All this is good news because

  1. I can once again run the latest GPG
  2. I no longer have to remember to downgrade GPG every time it gets updated for some reason

I’m writing this post in the unlikely event that someone else hasn’t heard the news and is still struggling to keep GPG 2.4.0 installed or perhaps who, unlike me, figured out how to pin it in Brew. It’s easy to lose track because once you have GPG 2.4.0 running, everything works fine and you don’t think much about the problem. If you’re like me, you probably don’t use it all that much anyway so you’re not bumping up against any problems.

In any case, the problem is solved.

Posted in General | Tagged , | Leave a comment

An Emacs IDE For Python

I’m not much of an IDE fan but many (most?) people are and want, in particular, to have some LSP integration for their favorite language. Lots of folks are using Python these days either as a quick-and-dirty scripting language or as their main programming language.

If your personal Venn diagram intersects with those two sets as well as the Emacs users set, The Emacs Cat has a useful post that describes his configuration for an Emacs-based Python IDE. It seems like a nice setup but doubtless some people will carp that there are better Pythons IDEs outside of the Emacs sphere.

Such a claim begs the question, “What do you mean by better?” It probably means that the LSP-like functions are better, that it can complete your partial library function better, or something similar. The thing is, you won’t be in Emacs and you won’t have all the unexcelled Emacs editing capabilities. Those are, to me, much more important than function completions and the like.

Still, it’s possible to have both and The Emacs Cat shows you how to do that. For whatever reason, Python has always been difficult in Emacs so it’s nice to see a post that gives a usable configuration for it. I’ve written about this before but that was almost 9 years ago before Eglot and Tree-Sitter were part of Emacs. The Cat’s post brings us up to date with what’s available now.

Posted in General | Tagged | Leave a comment

From The Too Much Time On Their Hands Department: Pink Floyd Division

Okay, okay. I wouldn’t be writing about this if it didn’t involve Pink Floyd but it does so here we are. Matthias over at The Corelatus Blog decided, at the request of a friend, to decode the phone system signaling tones that appear in one of the songs from Pink Floyd’s The Wall. He was handicapped because he was working from the movie instead of the actual song, Young Lust, from the album.

His explorations would make any nerd proud. He generated a spectrogram and compared it against the various phone system signaling protocols that existed at the time The Wall album and movie were produced (late 70’s early 80’s). Here in the U.S., those who know anything about the in-band signaling systems used at the time are familiar with AT&T’s but other countries had their own systems that used different tones. Matthias was unable to match the tones from the soundtrack to any of them.

Had he been a Pink Floyd fanatic fan like we here at Irreal, he would have known that the tones came from Young Lust and that, in fact, it was a recording of an actual call. Even the operator on the track is a real operator unaware that she was appearing in a rock song. Listen to the song to hear her puzzlement at the other side’s continued hanging up.

Matthias has an after note that mentions most of this. I like his post because

  1. It involves the greatest rock band of all time, and
  2. It demonstrates the typical nerd approach to solving a problem, no matter how trivial.

None of it matters at all, of course, but if you like Pink Floyd trivia and enjoy seeing a nerd approach and solve problems, take a look at his post

Posted in General | Tagged | Leave a comment