Writing With Emacs

This post is about another of my browsers tabs that I’ve had open seemingly forever. It’s a curated list of resources for writing with Emacs. As such, it’s a nice coda to my previous post on Emacs writing workflows.

It’s mostly a list of tips and how-tos rather than links to tools. Many of the links point to things that Irreal has covered before but there are plenty that are new to Irreal.

There are sublists for writing blogs, technical documents, screen plays, and books. There are also links for writing workflows and Emacs modes and configurations for writers. If you’re a writer, there’s a lot of good material on this site worth perusing and you should probably bookmark it for easy reference.

This site is a good demonstration of the fact that Emacs, as an editor, is useful for much more than just writing code. Lots of people, me included, use it for virtually everything we write. The same things that make it so good for editing text also make it ideal for writing prose or text of any kind. As I’ve said before, every time I write in something other than Emacs, I feel like I’m in Bizarro World where nothing works as it should.

Posted in General | Tagged | Leave a comment

An Emacs Writing Workflow

I’ve written before about Peter Prevos and his Emacs Writing Studio but here’s a bit more. I’ve had this article about the Emacs writing workflow up in my browser for a long while and decided the time had come to either write about it or delete the tab.

Prevos views writing as a five step process:

Ingestion
Reading, listening to, or watching content as a source of ideas. Emacs, of course, has extensive support for this.
Ideation
This stage involves taking notes about the content from the ingestion step. Emacs has exceptionally strong support for this with the Org package as well as other packages, such as Denote and Org Roam, to help you organize your notes. Prevos uses five types of notes that you can read about in his article.
Production
This is the step where you write your post, article, book, or whatever. It is, I think, the most enjoyable part of the process. Again, Emacs has our backs for this step. Unless you have special requirements, you almost certainly want to write your text in Org mode. The Org markup makes it easy to apply almost any formatting you’re apt to need for a writing project and the export system lets you deliver the final product in almost any format.
Publication
This is where you produce the final product. It could be a simple post, a longer magazine or journal article, or a even book. If you wrote in Org mode, you can produce a product suitable for any or all of these with the push of a button.
Communication
In this step, you tell the world about your product. Emacs has support for email, IRC, social media and other ways of communicating from inside the editor.

If you produce written output, you’ll probably recognize most of these steps even if you don’t follow Prevos’ workflow exactly. I use something vaguely resembling the first four steps but don’t do anything about communicating my daily Irreal output.

Prevos notes that his workflow is his workflow and others most likely do something different. Still, there’s some good ideas in his article that any writer can adapt for their own use.

Posted in General | Tagged | Leave a comment

Recover Session

I just came across a really interesting post from Tory Anderson. Like me, Anderson lives in Emacs. In fact, since he’s a Linux user and runs exwm, he lives in Emacs even more than I do. Anderson notes that sometime Emacs crashes or freezes and has to be restarted. We’ve probably all experienced this. It doesn’t happen very often to me but it does happen. I’m pretty conservative about Emacs and don’t run unreleased versions. Lots of people do, though, and they probably have more crashes and hangs than I do.

In any event, the question is what do you do about recovering files that were open and unsaved when the editor died? Emacs, of course, has us covered. The recover-file command lets you recover (most of) what was in the buffer when Emacs died. It gets that information from the auto save file for that buffer, which is why it may not have everything.

The problem is, you have to remember which files to recover. Anderson says he did this by going through his error log. It turns out, though, that Emacs has us covered here too. You can run the command recover-session and it will present you with a list of every session’s saved data that it knows about. You pick the one you’re interested—usually the most recent one—and then run recover-session-finish (bound to Ctrl+c Ctrl+c) and Emacs will query you for each file it knows about in that session and ask you if you want to recover it.

Anderson describes a slightly different process involving only recover-session-final that didn’t work for me so be sure to read the documentation too.

Posted in General | Tagged | Leave a comment

Emacs, Org, and Pandoc

I’ve been writing in Org mode for a long time. Every bit of Irreal began life as an Org doc and I have a huge collection of private documents that are also written in Org markup. The killer feature of Org is that I can export the same Org document to virtually any output format that I need. That’s mostly HTML and PDF for me but occasionally I’ll export to docx when I have to share with heathens.

I have always found that the native export functions work well for me but some people with special needs or especially complex documents find that they need more. Not to worry, Emacs, as usual, has you covered. You can also export to Pandoc and let it convert your Org document into virtually any format you can imagine.

İsmail Efe Top is one of those people who uses Pandoc for his exports. To be honest, it’s not clear to me that the native exporters wouldn’t work well for him but he certainly knows his requirements far better than I. Regardless, he has a useful post that shows you how to use Pandoc for exports if you need to.

As far as I can tell, Pandoc is mostly needed when exporting to docx but I’ve heard of some folks who feel that it does a better job of exporting to PDF than the native exporter. If you have to export to docx or feel that you need something more for PDF conversion, take a look at Top’s post to see how easy it is to add Pandoc into your exporting workflow.

Posted in General | Tagged , | Leave a comment

WiFi In The Rain: An April First Story

I may have mentioned before that I always dread April Fools Day. The web is inevitably full of silly stories that start off making a bit of sense but quickly degrade into farce. Predrag Gruevski brings some welcome relief with his April Cools feature. It’s an April 1st feature that tells a typical April Fools Day story with the twist that it’s true.

This year’s story is about a WiFi connection that only worked when it rained. At the time of the story, Gruevski was a student who had come home between semesters to spend some time with his parents. When he got there, the Internet wasn’t working. When he asked his father about it, his dad told him that the WiFi only worked when it was raining. The story gains interest when we discover that his father is not some geezer with a flashing DVR clock but is, in fact, an engineer with extensive networking experience.

Gruevski solved the problem with a flash of inspiration. You’ll have to read his post to find out what was going on but it’s a good story and worth a couple minutes of your time.

I love stories like this. It reminds me of the 500 mile email limit. They’re unbelievable stories that you immediately write off as the ravings of the technologically illiterate but which turn out to be true.

Gruevski’s April Cools feature is a welcome respite from the usual April 1st nonsense. It’s almost enough to make me stop dreading the day.

Posted in Blogging | Tagged | Leave a comment

Compiling

I’m an old guy and I’ve been programming for a long time. Virtually all of that programming has involved using a compiler or an assembler. Until I dabbled in AWK, Perl, and Python and started using Giuile, my only use of an interpreted language was some early recreational use of BASIC.

From my very first programming language—FORTRAN (gasp) as an undergraduate Math student—I have been fascinated with compilers and the compiling process. In my career, I’ve implemented a bunch of little languages and even worked on a large scale compiler.

It would, therefore, never occur to me that any programmer would not understand what a compiler is or does. Not how they work—that’s a bit of a dark art—but just what they are and what they do. Apparently, in this as in so many things, I’m wrong.

Nader Naguib says that he’s seen a lot of beginners who don’t know about compilers so he published a short video on what they are and what they do. It’s doubtful that any Irreal reader is confused on the matter but if you have a junior colleague who is, this is a good two minute introduction. The video is biased towards the C/C++ languages but really applies to any language even if it doesn’t need a preprocessor.

Posted in General | Tagged | Leave a comment

The Reddits

As many of you know, I’m a big fan of Paul Graham. He’s the guy who got me interested in Lisp and, by extension, Emacs. There’s a bit of irony there considering that Graham is a Vim user and his writings are the proximate cause of me leaving Vim for Emacs.

These days, he apparently thinks of himself primarily as an essayist. You can check out many of those essays here. I just ran across another of his essays/posts on Y Combinator. It’s a sort of history of reddit as told from the Y Combinator point of view.

It’s an engaging tale. One surprising aspect of the story is that Y Combinator hated the first proposal from the two founders, Steve Huffman and Alexis Ohanian, and rejected it. But both Graham and his wife really like them and encouraged them to come up with another idea. Graham apparently suggested the reddit idea because of his experience with Delicious, a site that was a distant cousin of what reddit would become.

The rest, as they say, is history. Within a matter of weeks, reddit starting gaining users who regularly returned to the site. If you have a couple of minutes to spare, reading Graham’s post would be a good use for them. As I say, it’s an engaging tale.

Posted in General | Tagged | Leave a comment

More On Pangrams

Back in 2020, I wrote a post about the New York Times Spelling Bee puzzle. The TL;DR is that you’re given a list of seven letters, one of which is special. Solving the puzzle involves finding as many words as possible using the letters, possibly repeated. Longer words score higher and using the special letter gives you a bonus.

I didn’t have time to search for all the words but I did like to find the pangrams: words using all seven letters. I could usually do that fairly easily but I hated puzzles where I couldn’t find any pangram. So naturally I invoked my inner nerd and wrote some Elisp to find them. You can check the above post for the details.

In the meantime, the Times had stopped sending me the puzzle so I’d pretty much forgotten about it. Now Bill Mill has revisited the puzzle. He was interested in finding any pangrams that would get you to the highest scoring level all by itself. Unfortunately, he didn’t have enough information to solve that problem so he he decided to find the lowest scoring pangram instead. He wrote some Python to solve that problem. You can read all about it in his post.

Later, he discovered some of the missing information he needed to solve the original problem and wrote another post about it. Amusingly, with the new information it turns out that the worst—i.e. the lowest scoring—pangram is “fuckwit” but he was also able to find the best scoring pangrams. See Mill’s posts for the details.

None of this matters at all, of course, but it is fun to see how Emacs and Elisp (or in Mill’s case, Python) can be brought to bear to investigate the problem.

Posted in General | Tagged | Leave a comment

🥩 Red Meat Friday: Multiple Editors

Today’s topic is using multiple editors. There’s no reason this should be a red meat topic but it is. People on both sides of the issue think those on the other side are weird.

I’ve written about this before and those of you with long memories will know that I’m firmly in the single editor camp. There are two reasons for that. First, Emacs does everything I need so why would I bother with another editor and all the overhead involved with maintaining it? Second, I have muscle memory issues trying to use more than one editor. I know from previous Irreal discussions that many users don’t have that problem but after 17 years I still find myself trying to use Vim bindings so the last thing I need to do is introduce another editor into the picture.

A couple of months ago, PetriciaKerman asked on the Emacs subreddit if anyone else found it weird that some engineers used two or more editors. It’s interesting to read through the replies. After filtering out the ankle biting we’re lefts with two—equally legitimate—viewpoints.

There are those, like me, who say you should find an editor that works for your workflow and spend your time mastering it rather than investing in—and never mastering—multiple editors. deaddyfreddy put it nicely: “It’s not weird, it’s dumb. People are willing to spend time learning shortcuts/setting up multiple apps for doing the same task – text editing.” The other point of view is that you should choose the best tool for the job at hand. As one commenter pithily put it, “Ever notice plumbers use different kinds of wrenches?”

As I said at the top, none of this should be controversial. People should do what works for them. But, of course, it’s always fun to dine on red meat.

Posted in General | Tagged , | Leave a comment

Visualizing Data With Emacs And Gnuplot

I really like Gnuplot. It can produce most of the types of graphs that you’d actually want to produce and it’s reasonably flexible. That said, I hardly ever use it. It’s sort of a chicken/egg problem: on the one hand, I don’t use gnuplot very often because I can’t remember how to use its (semi-arcane) command language. On the other hand, I can’t remember the language because I seldom use it.

I just ran across a very short video from Anand Tamariya that shows the user selecting a rectangle of data, calling gnuplot-rectangle, and having a graph of the data be rendered by gnuplot. The video is only 35 seconds and doesn’t have any explanation. I was bitterly disappointed because it seemed like an easy way to use gnuplot for many of the cases I care about.

Serendipitously, I had another tab open in my browser by the author of the video that showed the code for gnuplot-rectangle and explained how to use it. There’s not much to do. You have to have gnuplot installed on your system, of course, and you also need to have the Emacs gnuplot package installed. That package is available from the Melpa and NonGNU elpa repositories so it’s easy to install. If you’re like me, you probably already have them installed.

The final piece is the gnuplot-rectangle function that Tamariya gives in his explanatory post. I haven’t had a chance to try it yet but it seems just perfect for folks like me that don’t need to draw graphs often enough to learn the intricacies of gnuplot.

Posted in General | Tagged | Leave a comment