Setting latexpreview on Document Startup

NOTE:
Once again, WordPress is refusing to publish the embedded tweet. I don’t think this is Twitter’s fault because it renders perfectly on my local machine; it’s just when I try to push it to WordPress that it fails. I’ve put a link to the tweet instead of the embedded copy.


Eric Fraga offers a tip that although it’s documented, I didn’t know about:

There’s a bit of context missing from the Twitter preview. Manning originally asked how to render LaTeX previews in a Org buffer. Fraga answered that by explaining the Ctrl+c Ctrl+x Ctrl+l key sequence and Manning asked if there was some way of invoking the rendering automatically. Click on the tweet to see the entire thread.

If you use LaTeX a lot in Org documents and like to see it rendered correctly, Fraga’s tip is really useful.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: Forget Linux, Just Use Emacs

An enduring trope in the Emacs community is the notion that Emacs isn’t really an editor, it’s an operating system. We always say we’re joking but sometimes it’s hard to tell. The idea is not completely unfounded. After all, there’s a huge list of things you can do from within Emacs that aren’t really about editing.

It turns out that some people take the idea very seriously indeed. HollywoodKizzle asks on reddit if he should stop learning Linux and just concentrate on Emacs. The advice he received was actually pretty reasonable. There were two takes. The first was to follow his passion and concentrate on Emacs. Opportunities to learn more Linux would inevitably present themselves as time went on.

The other advice was to learn both in tandem. As I’ve said many times, I love staying in Emacs as much as I can but I still find I need to step outside its boundaries occasionally. Of course, as a Linux user, HollywoodKizzle could use EXWM and always stay in Emacs. Even without EXWM, one can invoke a shell and get access to the underlying OS so it always pays to be familiar with as much of the hosting OS as possible.

In any event, the Red Meat Friday message for you Linux heads is to be on guard because Emacs is coming for you.

Posted in General | Tagged , | Leave a comment

Derek Sivers on Plain Text

A recurring theme at Irreal is the virtue of using plain text wherever you can. To my mind, using a proprietary format makes you complicit in the data loss that will inevitably occur sooner or later.

Derek Sivers agrees and has his own post on why you should write plain text files. He begins by saying that he writes down virtually everything important in his life and that he refers to that writing often. Naturally preserving those writings and making sure that they remain available is a priority. A large part of that for Sivers, as for me, is writing all that material as plain text.

Sivers mentions the usual issues of portability and freedom from the vicissitudes of commercial software vendors and the realities of their business. He also mentions the less familiar advantages of plain text such as the ability to convert it into other formats. Even if you’re required to deliver or share a document in something like a DOC file, it’s a simple matter to convert plain text to that format, all the more so if you’re writing in something like Org markup.

The other little-mentioned problem is software that requires an Internet connection to operate. I’ve written before—although I can’t find the post—about a law firm that couldn’t complete legal documents before the filing deadline because their document preparation system, which required an Internet connection, was unavailable due a problem at the vendor’s end. The horror stories write themselves.

Siver’s post is short and worth a read. You can probably read it in a couple of minutes so give it a look.

Update [2022-03-03 Thu 13:44]:
Here’s a couple of examples of people being unable to do their work because their “word processing” software was offline. I misremembered the anecdote about the lawyer: that turned out to be a hypothetical but the point stands.

Posted in General | Tagged | Leave a comment

How To Use Tags

In response to my post Renaming Tags, Karl Voit pointed me to his recent post on How To Use Tags. He said that his system could solve many of the problems I experience with using tags. It’s a long post with lots of good advice but the heart of it are 8 rules he uses for choosing tags. It’s definitely worth taking a look at those rules if you use tags.

The two rules that would most help me are:

  1. Use as few tags as possible
  2. By convention, tags are plural

My major problem is #1. Rather than deciding on a specific set of tags, I tend to make them up as I go along. All of my tagging is happening in an Org Mode context so I get a list for the first tag but I’m on my own for any subsequent tags so I can’t see what I’ve used before. Voit’s tagging system is more general and acts at the file level so his tools have a way of handling this problem.

After dealing with grocery/groceries for a while I (sort of) settled on a rule of using the singular form but I didn’t make it a hard rule. A lot of my problems would disappear if I strictly enforced this rule.

Even if I religiously followed Voit’s suggestions, I would still find myself needing to bulk change tags so I’m grateful for Sagar’s post. Still, if you’re a tag user, you can make your life a lot easier by reading and following the advice in Voit’s post.

Posted in General | Tagged | Leave a comment

Using Paredit’s Slurp and Barf

I’ve been using paredit for 11 or 12 years. I don’t use nearly all its features but I still wouldn’t want to live without it. As I discovered early on, the real secret of paredit is understanding slurp and barf. Without them you can’t edit your file effectively.

Susam Pal has a short post about mnemonics for remembering the shortcuts for paredit’s slurp and barf. Some developers, he says, confuse the shortcuts for snarfing for those for slurping. Pal provides the mnemonics that he used to remember them. I never had that problem. To me, the braces suggest pointing out so Ctrl+} and Ctrl+{ are clearly for barfing.

Actually, I don’t find his mnemonics very helpful but your mileage may vary. His post also gives examples of using slurp and barf so you may find that helpful if you’re not familiar with paredit. One thing for sure, if you’re writing in any of the Lisps, learning paredit is definitely worthwhile.

Posted in General | Tagged | Leave a comment

Podcasts with Elfeed and EMMS

Arne Babenhauserheide has an interesting post on how he listens to podcasts in Emacs using Elfeed and EMMS. It’s a perfect workflow: the podcast episodes are collected from RSS and listed with Elfeed and those he wants to listen to are queued by simply typing A next to the entry in Elfeed. That queues up the entry in EMMS. Babenhauserheide has a step-by-step guide to the workflow in the post.

There’s a tiny bit of configuration to do but it’s just a few lines. Best of all, everything happens from within Emacs and you can do other work while you’re listening if you like.

I don’t generally listen to podcasts but if I did, I’d certainly try this method out. The nice thing about it is that it’s simple to set up and try out. If you decide you don’t like it, it’s easy to back out the changes. Of course, you’ll want Elfeed regardless because it’s the absolute best RSS reader. I don’t use EMMS because

  1. I’m too lazy to set it up
  2. I don’t usually listen to music while I’m working so I just depend on iTunes. (See #1.)

If you’re an Emacs user who listens to podcasts, be sure to take a look at Babenhauserheide’s post. The section on Elfeed/EMMS is short and will take less than a minute to read.

Posted in General | Tagged | Leave a comment

Renaming Tags

Ravi Sagar has a quick video that shows you how to bulk-rename tags in an Org file. If you don’t use tags in your Org files, this probably seems like something you’d hardly ever want to do. Indeed, even Sabar doesn’t seem to understand its real use. But if you do use tags regularly, it’s extraordinarily helpful.

I have several Org files—such as my journal and blog queue—that have one or more tags for every entry. If you’re a real person, you probably get confused when specifying tags. Is it grocery or groceries? Or maybe you get confused about capitalization. My tags are (supposed to be) lower case but sometimes habit takes over and I automatically capitalize a tag that also happens to be a proper name. In any event, I often find myself needing to change several instances of a tag in a file.

Sagar shows a snippet of code that allows you to do just that. You specify the name of the tag you want to change and the name you want to change it to and the code takes care of it for you. The code is from Stack Excahnge and is here. Again, if you don’t use tags you’re probably saying, “Meh, who cares” but if you do, you can immediately see the usefulness of the code.

Posted in General | Tagged , | Leave a comment

Scheme as a Prototyping Language

The other day I saw a link to this short essay on using Scheme as a prototyping language by Jonathan Sobel. The TL;DR is that Sobel was taking an Algorithms class and was assigned a project to implement the fast multiplication algorithm with part of the grade based on fast it ran.

Most of Sobel’s classmates started writing in C. A few of them went directly to assembly language. They spent a lot of time debugging their highly optimized C and assembly code. Sobel pursued a different track; he started writing in Scheme. He began with a naive implementation of the algorithm and iteratively refined it.

Scheme is ideal for this. The language allows one to make correctness-preserving transformations to the code that eliminates function calls and allowed the caching of execution context. Once Sobel had his Scheme implementation optimized, he translated the code into C.

The results were impressive. Sobel’s implementation was the second fastest in the class, beaten only by an implementation written predominantly in assembly language. Sobel says that if he’d known a bit more about Scheme, his implementation would have come in first.

For almost all projects, I find writing in some sort of Lisp gets the job quickly, more accurately, and with a result efficient enough for a final product. In those rare cases where more speed is needed, Sobel’s strategy of writing in a Lisp, debugging and optimizing the program, and finally translating into C is a good strategy.

Posted in Programming | Tagged , | Leave a comment

Red Meat Friday: Taking Up Space With Metadata

Note: For some reason WordPress refused to embed Fraga’s tweet so I had to link to the tweet instead.


As you all know by now, I prefer a minimalist approach to my editor screen layout. I want as much screen real estate as possible devoted to the file I’m editing. That maximizes context and minimizes scrolling. Eric Fraga, it appears, agrees:

When I first saw that screenshot, my immediate reaction was, “Why would anyone do that?” Look at that layout. It’s got all sorts of metadata about other files displayed but devotes only a third of its working space to the point of an editor: editing the text of a file.

After thinking about it for a while, I came to the realization that the people who prefer this type of configuration find text boring. It’s not “modern looking”, it’s not flashy, and worst of all it doesn’t look cool. But a setup like VS Code’s default? That’s happening!

Of course, as I’ve said before, different strokes for different folks so use whatever works for you. Still, I maintain my cranky, much maligned opinion that serious developers don’t use setups like that. Let the abuse begin.

Posted in General | Tagged , | Leave a comment

Six Useful Emacs Settings

David Wilson over at the System Crafters Channel has a new video up on The 6 Emacs Settings Every User Should Consider. The six settings are

  1. Enable remembering recently edited files
  2. Enable minibuffer history
  3. Enable remembering last place visited in file
  4. Changing the location of the custom file
  5. Disabling UI dialog boxes
  6. Enabling automatic reversion of file changes

Even intermediate Emacs users are probably familiar with most of those settings although I had never heard about disabling dialog boxes before. That’s probably because they only come into play when you’re using the mouse, which I virtually never do.

Oddly, I use only two of these settings. I have my init.el under version control so it’s really annoying when some random function decides to scribble in it. That can be avoided by moving the custom data to a separate file. That file will also receive the random scribblings so my init.el doesn’t get corrupted with transient information.

The other setting I use is to enable minibuffer history. That’s really useful and something I take advantage of many times a day.

I haven’t explicitly enabled recentf but something else in my configuration has because recent files are being saved and when I tried recentf-open-files I got the list as shown in the video. Even so, my workflow is such that I’d hardly ever use the facility so I ignore the setting and will probably forget all about it soon.

The same goes for remembering the last place visited in files. I hate that kind of thing. Emacs has great search capabilities—which avy makes even better—so I can always easily find where I want to go in a file. Most likely that’s the end of the file so a simple Meta+> suffices.

The same goes for global-auto-revert-mode. My workflow just doesn’t have the problem of other processes updating files I’m working on so the overhead isn’t worth it to me.

Other folks will certainly have preferences that differ from mine so it’s worthwhile taking a look at the video. The run time is 15 minutes, 40 seconds so plan accordingly.

Posted in General | Tagged | Leave a comment