A Back Button For Emacs

I do a lot of my writing on my couch with my MacBook on my lap. That provides a less than optimal typing environment so I frequently mistype a command and end up magically transported to another place and time. Sometimes it’s just to another place in my current file but often it’s to another file altogether.

Apparently, I not the only one who suffers from this. Chris Maiorana, who writes for a living and uses Emacs to do so, has the same problem. He asks, wouldn’t be nice to be able to have a “back key” that would take you back to where you were before you fat fingered some command and were transported into the nether regions.

Maiorana notes that Emacs pretty much has this out of this box with push-mark that stores your location before many location moving commands. It stores your current location in the “mark ring” from which you can pop the location to return to the place where the mark was pushed.

But, asks Maiorana, what if you want to go forward too? It’s not to hard to imagine situations where you want to go back and forward between locations during your editing. It turns out that you can do that too with the help of the backard-forward package. Maiorana has a few more details in his post so take a look if you’re interested.

If you don’t want to add another package, you can simply use Ctrl+u Ctrl+Space to pop the last saved location and go to it.

I use Ctrl+u Ctrl+Space all the time but do forget to use it when I inadvertently find myself in an unexpected place. Whether you choose to install the backward-forward package or simply rely of popping the mark, it’s good to be aware of how simple it is to recover.

Posted in General | Tagged | Leave a comment

The NTSB Speaks

As you probably know, we here at Irreal take a dim view of Management meddling in the inner workings of Engineering. That is not at all the same as taking a dim view of Management: they are an important and necessary part of any business but their expertise does not, usually, extend to the best way of running an engineering department. A good rule, it seems to me, is that if you don’t have an engineering background, leave the running of Engineering to those who do.

That brings us to the poster child for this problem: Boeing Aircraft. Boeing once exemplified the perfect company involved in engineering. For a long time they defined the aircraft manufacturing industry. I’ve written a lot about Boeing and its problems but all those posts can’t begin to capture how profoundly sick the company is.

Now the National Transportation Safety Board has weighed in on the in flight separation of a door plug on a Boeing 737. Read their recommendations. It seems like a list of things that any responsible company would do before shipping a product that people depended on not to kill them. As the NTSB makes clear, this incident was a Management failure both on the part of Boeing and the FAA.

I’m sure there are a lot of lessons that can be drawn from all this but mine is simply this: When managers without engineering expertise start meddling in Engineering, you can be sure that it’s going to end in tears.

Posted in General | Tagged | Leave a comment

Flyover

Note: Sorry, I got caught up with life and completely forgot to publish this this morning.

If you’re a Flycheck or Flymake user and like eye candy, you might enjoy this new package from Mikael Konradsson. It’s a nice looking overlay for Flymake and Flycheck. There’s a couple of screen shots at the link that show what it looks like.

There’s a lot more information at the project’s GitHub repository. There are more screenshots and a more comprehensive explanation of what it does and how it works. As I said, there’s a lot of information at GitHub so you should definitely take a look at that if your interested but here’s a list of it’s features taken from the repository:

  1. Nice looking, customizable overlays for error display that are theme aware
  2. Errors, Warnings, and Info messages are distinguished by different styles
  3. Realtime updates while editing
  4. Smart position and formatting of messages
  5. Efficient overlay management
  6. Markdown-style syntax highlighting in messages

The package is available from Melpa so it’s easy to install if you’d like to try it.

Posted in General | Tagged | Leave a comment

Resetting All Checkboxes In An Org Buffer

Marcin Borkowski (Mbork) has a problem that many of we Org users have: He likes to use checkbox lists to organize tasks to ensure that he doesn’t forget any steps. An example that will resonate with most of us is using a checklist for things to pack for a vacation. So what’s the problem? The problem is how to reset those checkboxes to unchecked for the next time you want to use the checklist.

For a long time, he just did the obvious thing and performed a query-replace to change [x] to [ ]. The trouble with that solution is that it didn’t reset the checkbox cookies so he had to do that by hand. Since he knows a bit about Elisp, he decided to write his own solution. It turns out that Org already has a function, org-reset-checkbox-state-subtree, that almost does that. It will reset all the checkboxes in the current subtree so all Mbork needed to do was write a function to step down the subtrees and call org-reset-checkbox-state-subtree for each one.

It’s a surprising small amount of code and neatly solves the problem. As Mbork points out, there are some problems. His solution will sometimes call org-reset-checkbox-state-subtree for the same subtree more than once and it apparently can mess with header folding but most files you’re going to use his function on are probably sufficiently small that it doesn’t matter.

I’ve written a bunch of code like this. It may not be ready to ship but it solves a problem and I understand its limitations. It’s a win.

Posted in General | Tagged , | Leave a comment

Writing With Emacs #1

Greg Newman has another episode of Emacs Carnival going this month. This time it’s about using Emacs for writing. That’s a subject I’m very interested in so I’ve been looking forward to this episode’s contributions. The first is from Erik L. Arneson who writes about how he uses Org mode for all his writing.

Arneson says he’s written about 500,000 words with Org mode. Before Org he wrote mostly in LaTeX or plain text. Now, he writes exclusively in Org. His story is a lot like mine, A quick check with grep and wc tells me that I’ve written about 2 millions words with Org. Before that I mostly wrote with Troff so I’ve been using one markup language or another for a long time.

The important thing, as Arneson says, is that I don’t have to use Word or any of its evil siblings for my writing. That matters to me because Org generally doesn’t have an opinion unlike most “word processors” that think they know better than I do what I want to write and feel free to change my text accordingly without asking.

As Arneson notes, writing in Org mode is tremendously flexible. He—and I—use it for blog posts, reports, spreadsheets for keeping track of household expenses, letters, emails, texts, and even books. When you add in Emacs Everywhere, virtually everything I write is in Emacs.

As I’ve said before, I can no longer write comfortably in anything else. All the other apps that deal with text seem like Bizarro World where nothing works as you expect it to. What Emacs user hasn’t experienced the frustration of trying to use Emacs bindings in other applications? See what I mean about Bizarro World?

Posted in General | Tagged , | Leave a comment

Safely Updating Emacs Packages

I tend to be a pretty conservative Emacs user. I generally don’t run beta versions and try to keep my packages up to date without constant upgrading. To be sure, some folks are much more conservative in that they save their old packages and don’t update either Emacs or their packages frequently.

I used to be much more aggressive about updating packages until an Org update completely broke my workflow. After that I tried to be a bit more circumspect. I was, therefore, interested in this post by Mario Jason Braganza about his plan for updating his packages. Braganza is much more paranoid than I am and for a long time didn’t update his packages at all. The problem with that strategy is that sooner or later the packages would break when he upgraded Emacs. To solve that problem, he devised a new package upgrade plan.

His plan is simple:

  1. Upgrade packages only once a quarter
  2. Before upgrading, stop the Emacs server, and backup the Emacs folder
  3. Update the packages
  4. Start Emacs manually and test the changes
  5. If everything is working restart the server and continue, otherwise revert the backup file, restart the server, and continue

That seems like a pretty good plan to me. I like the idea of backing up at least the elpa subdirectory before upgrading and I think a quarterly upgrade schedule makes a lot of sense. Unless you’re having problems with a package there’s probably no need to install every update.

Posted in General | Leave a comment

Speeding Up Magit On macOS

If you’re using Magit on macOS, here’s a tip that will either improve your life considerably or not affect you at all. The tip is from Greg Newman who says that it reduced his commit time from about 4 seconds to less than a second.

The secret? It turns out to be simply specifying a pointer to the git executable like this:

(use-package magit
  :bind ("C-x g" . magit-status)
  :custom
  (magit-git-executable "/opt/homebrew/bin/git"))

Of course, after the excitement dies down, you start thinking, “Wait! What? That can’t be right.” Well, what can’t be right is that it’s taking 3 seconds to find the git executable by searching the PATH variable. What is happening then?

It turns out that Apple provides a copy of git that it puts in /usr/bin/ but if you’re using Homebrew and loaded git with it, the executable lives in another place. In Newman’s case, that place is /opt/homebrew/bin/. In my case, it’s in another place but the same thing happens: there are two versions of git in your file system and unless you’ve performed surgery on your PATH variable, Emacs will probably find the older version provided by Apple.

What’s really going on here, it seems, is that without some further action on your part, Emacs—or more precisely, Magit— may be finding the older, presumably slower, version of git. You might wonder why someone would load git from Homebrew. As I recall, the version of git provided by Apple wasn’t quite working correctly and, in any event, you might want the latest version with all its improvements and bug fixes.

Regardless, if Magit seems slow you should:

  1. Make sure you have the latest version of git loaded from Homebrew or elsewhere
  2. Ensure that Magit finds that git either by adjusting your PATH variable or setting an explicit path as Newman does.
Posted in General | Tagged | Leave a comment

Simply Annotate

James Dyer has announced a new package called Simply Annotate. It is, as the name suggests, a package to make annotations to a file with the feature that the original file is not modified. There are, of course, as Dyer says plenty of packages that do this sort of thing but he wanted a light weight package that specifically met his needs and preferences.

Dyer has a list of those preferences, which you can read at his post or you can take a look at the user manual. Regardless, it appears to have some nice features. Dyer has an animation that shows how the system works. The package is available on Melpa or directly from its GitHub page. There’s plenty of information on Dyer’s post, which appears to be essentially the same as the GitHub README.

I’ve tried very hard in the past to warm up to applications like this. After all, they make perfect sense: you can make personal notes concerning the file content without altering the file itself. I spent a certain amount of time making such notes but then never—ever—actually read them. I reluctantly concluded that such things were not for me. But they may be just right for you so you should definitely take a look.

Posted in General | Tagged | Leave a comment

Emacs Users: How Are Your Hands?

Over at the Emacs subreddit, SecretTraining4082 asks long term vanilla Emacs users how their hands are holding up. You’d be forgiven if you think the answer is “terrible”. After all, it’s received wisdom that Emacs’ default key bindings are particularly hard on your hands and inevitably lead to Emacs pinkie or some other form of RSI. Certainly there are serious and well informed people like Eric Fraga who say that RSI caused them to move to Evil mode.

I’ve always taken these people at their word, of course, but, even more, have generalized their experience to the larger Emacs user population, even though I have never suffered from any RSI problems despite years of Emacs use and even more years of constant keyboard use.

I was, therefore, a bit surprised at the answers to SecretTraining4082’s question. Almost every responder said that they didn’t suffer any significant RSI problems despite years of vanilla Emacs use. Many of them attributed this to turning the Caps Lock key into another Ctrl key. I’ve been doing this for as long as I can remember—long before I was an Emacs user—so perhaps that helps explain my lack of RSI problems.

Some of the commenters recommended the usual things like split/ergonomic keyboards but it’s surprising how many said they have been using vanilla Emacs for 30 or 40 years without any problems and without doing anything special other than making Caps Lock into another Ctrl key.

There are, for sure, people who do suffer RSI problems from the default Emacs keybindings but I was surprised at the number of people who said they didn’t. It appears that the idea that Emacs keybindings inevitably lead to RSI may be another trope used by Emacs haters to justify their animus.

Posted in General | Tagged | Leave a comment

Emacs Second Try

After yesterdays post about Charles Choi’s second take on Eshell, I discovered that Choi’s post was part of a collection by Christian Tietze on a second take on various Emacs topics. Tietze himself had a post on Emacs on Second Try.

His story is not at all like mine. He first use of Emacs was under duress as part of a university course. He used it because it was required but left it behind as soon as he could. He was pretty happy using it with the text based terminals at school but once he got his first Mac he abandoned it completely.

Over the years, he learned about things like the package system and compiling from within Emacs. He was also attracted to the configurability of Emacs. He liked some of the Xah Lee’s bindings and was able to incorporate them into his Emacs configuration.

Eventually, of course, Tietze became a convert. His story and mine are alike in one respect: we both initially resisted Emacs and spent some time overcoming that resistance. And, of course, we both became committed Emacs users.

It is, really, a common story. Many of today’s zealous Emacs users took some time to adopt it. For some, like me, it took several tries before it took.

Posted in General | Tagged | Leave a comment