Transient Input Method

Marcin Borkowski (mbork) has a short post that brings news of an upcoming feature in Emacs: transient input method. It’s much like toggle-input-method used to switch to another input method but it’s only in effect for the next character. That can be handy if you need to enter, say, a LaTeX character but don’t want to stay in TeX input method all the time. Of course, you can always just toggle the TeX input method off again but that’s a bit of a pain.

I use the TeX input all the time. It’s usually because I want to use --- to enter an em-dash. That works without TeX input method but the Unicode character it uses messes up the RSS feed. The em-dash character used by TeX input method works correctly so I have to switch input methods to use it. The trouble with the TeX input method for me is that my key chords (as defined with the key-chord package) don’t work so I have to either toggle the input method again or use some other way invoking the function bound to the key chord.

Transient input method isn’t available in Emacs 27.2 so I haven’t had a chance to use it yet but it seems like it could really be handy much of the time. As Borkowski points out, transient input method is an example of polishing Emacs to make editing a bit more pleasant and once again puts the lie to the claim that Emacs is old, defunct technology.

Posted in General | Tagged | Leave a comment

Rectangle Mark Mode

Today, I saw this tweet from Tory Anderson:

It reminded me that I used to use it all the time and thought I even had a shortcut for it but when I called describe-function it said there was no binding associated with it. I searched my init.el and found that it was actually defined as part of a hydra dealing with rectangles.

I was happy to rediscover this and am writing about it in case some of you may have forgotten about it too. In a sense, it doesn’t really bring anything new but it does make it much easier to visualize the rectangle and how the text will be affected when you issue a command on it.

I stole the hydra from this post by abo-abo. The thing with rectangles is that most of us don’t use them enough to burn the keystrokes into our muscle memory, so the hydra is really useful. Of course, you still have to remember that you have the hydra and what its keybinding is. Something not all of us, apparently, can do.

Posted in General | Tagged | Leave a comment

Understanding Hi-line-mode

Tony Aldon wondered how hi-line-mode worked so he looked into it. He was so enchanted with what he found that he decided to share it on reddit. That might not sound too interesting but hi-line-mode depends on two Emacs features, post-command-hook and overlays, that are interesting in their own right. Once you understand them, understanding hi-line-mode is trivial.

The post-command-hook variable, as its name suggests, contains a list of functions to run after every command. Since virtually everything Emacs does—including inserting characters into a buffer—is through a command, the hook gets run every time Emacs does something. In particular, hi-line-mode can be called after every command to update the current line’s highlighting.

The other important aspect of hi-line-mode is the overlay. This is pretty simple and allows you to, among other things, change the text face of a region in the buffer. In the case of hi-line-mode, it changes the background color of the current line to whatever color you’ve chosen.

Once you grok hooks and overlays, it’s easy to understand how hi-line-mode works. Aldon’s post is useful not because it explains how hi-line-mode works but because it explains post-command-hook and overlays. Those are things you can use in your own Elisp code.

Posted in General | Tagged | Leave a comment

Reading RSS With Elfeed

Irreal regulars know that I’m a huge fan of Christopher Wellons’ Elfeed. It’s an Emacs-based RSS reader that allows you to manage and read your RSS feeds from within Emacs. If you’re already an Emacs user, there’s no reason not to be using it.

Ramces Red has a post that explains how and why to use elfeed. Ramces covers the installation and configuration of Elfeed. Other than specifying which feeds you want to follow, you can get away with no configuration at all but Elfeed allows extensive customization. There’s also a thorough and flexible tagging mechanism that you can use to sort posts according to interest.

To me, the most useful thing Elfeed brings to RSS is the ability to store the feeds forever. They all go into a database that is searchable by date and content. Even years later, you can search and find an entry and as long as the original post is still online, you can revisit it.

The one thing that his post doesn’t mention is that you can maintain your list of feeds in Org-mode. To do that you need to load elfeed-org. After that, it’s easy to add or delete entries from your feed even if you aren’t an Elisp expert.

I can’t recommend Elfeed enough. Take a look at Ramces’ post to see why.

Posted in General | Tagged | Leave a comment

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