More Emacs Startup Time

Because I know you guys never stop jonesing for another episode of the endless debate on Emacs startup time, here’s yet another post to feed your addiction. Over at the Emacs subreddit, prothtuahel complains that Emacs is taking 3 seconds to load 412 packages1 when all he wanted to do was add a TODO to a file.

There’s so much to say. First, why are you restarting Emacs for each file you want to edit? I know it can be disorienting for new users but when you’re using Emacs, you should leave it running all the time and not restart it every time you want to edit a file.

Second, if you must restart it for each file, start Emacs in server mode and use emacsclient to invoke it for each editing session. Emacsclient will start instantly because Emacs is already waiting in the background. But really, see the first point.

Third, you’re complaining about taking 3 seconds to load 412 packages? That’s actually pretty fast, but see the first and second points.

The comments mostly concentrate on the three points above but, of course, someone points out that you can speed things up with lazy loading. To me, the most cogent argument is that who cares?. If, as you should, you only load Emacs a few times a month or year, who cares how long it takes to load? I always get pushback when I write that but unless you’re one of the few people with special needs that require starting Emacs often, it remains true.

Footnotes:

1

Sadly, once again reddit has chosen to delete the post because reasons but the headline and comments are still there. Someone really needs to sit the reddit mods down and have a polite but firm discussion.

Posted in General | Tagged | Leave a comment

Why Did You Switch From Vim To Emacs?

Over at the Emacs subreddit, floofcode asks those who moved from Vim to Emacs to tell their stories. On the one hand, it’s pretty much what you’d expect. The majority of the commenters said it was either Org mode or Magit (or both) that convinced them to move.

The second most popular response was that Evil mode—with or without Doom or Spacemacs—was the selling point. Those users felt that they got all the familiar benefits of Vim along with the power of Emacs.

For me, the most interesting responses where from those users who said that they found Emacs to be faster and easier to use than Vim. That’s a bit of a surprise. It’s received wisdom that Vim is faster and easier to use than Emacs, yet these users found just the opposite.

Oddly, none of these answers apply to me. I migrated from Vim to Emacs before the time of Org mode or Magit. And, although I was a long time Vi/Vim user, I didn’t embrace Evil mode but jumped right into the conventional Emacs milieu.

So what was the attraction? At this point, I don’t really remember. I think it was about the time I started using Lisp and Scheme seriously so it seemed like the Lisp based Emacs was a natural choice. As I’ve written before, I’d made tentative attempts to move to Emacs before but one silly thing or another always stopped me. Suddenly, the universe and I were ready and I moved to Emacs without looking back.

Posted in General | Tagged | Leave a comment

-2000 Lines Of Code

I recently reported the sad news that Bill Atkinson—considered by everyone who knew him one of the best programmers of all time—had died. One of my favorite stories about him was recounted by Andy Hertzfeld at his Folklore website. Someone just reposted a link to the story and even though I’ve written about it before, it’s worth revisiting.

The TL;DR is that just as Apple was getting ready to release the Lisa software some management drone decided that it would be useful to track progress on the project and that the way to do that was to have each programmer provide a weekly report of how many lines of code they’d written that week. Anyone with a functioning cortex will have no problem seeing the problem with that plan. It’s the poster boy for Goodhart’s law: pretty soon every developer would be reporting thousands of lines of code every week and the code base would become bloated, inefficient, and slow.

Atkinson, of course, had no problem seeing how ridiculous the new dictum was. Serendipitously, the week the requirement went into effect, Atkinson had been working on optimizing Quickdraw’s region calculation code and was able to make it 6 times faster while reducing the amount of code by 2000 lines.

Atkinson expressed his disdain by reporting his progress as -2000 lines of code. It didn’t take long for management to stop asking Atkinson for the report.

The story is so perfect that it’s almost impossible believe in the existence of a manager actually believing such a policy would be a good idea. I can assure you they exist. I have seen, more than once, such measures being proposed and sometimes even implemented. It’s another example of why Management should keep its nose out of the inner workings of Engineering.

Posted in General | Tagged | Leave a comment

Casual Man and Help

A quick post today.

Charles Choi has just released another app in his Casual suite. This time it’s for the man and help modes. We all use these all the time, of course, but there are plenty of obscure bindings that most of us don’t remember. As usual Choi’s app helps with that by providing easily invoked menus.

Along the way, Choi also tells us about some little known features of man and help mode. For instance, when in man mode, you can press Return when the point is on another command and Emacs will open the man page for that command whether or not it’s an actual link. There are a couple of other nice facts like that so be sure to take a look at Choi’s post.

As I always say when I do one these posts, Choi’s Casual suite just keeps getting better and better and since you can use the same binding to invoke the appropriate menu, they’re easy to use and well worth installing.

Posted in General | Tagged | Leave a comment

Making TRAMP Faster

One of Emacs’ really nice features is TRAMP. It allows you to edit files on a remote system and otherwise interact with that system as if you were working on your local machine. The problem with it is that it can sometimes be slow, even unusably so.

Troy Hinckley over at Core Dumped has a very interesting post on making TRAMP faster. Oddly, almost everything he does is merely adjusting settings. He writes a bit of code to implement caching but even that is minimal.

Hinckley’s post is long and complicated because he explains what he’s doing and why it works. He’s spent a lot of time profiling and researching how TRAMP works. That’s nice because it means that he’s not just trying things to see if they work.

This is a short post because rather than simply listing the things that Hinckley did without explaining the reasons for them, I’m going to send you over to his post to get the full story. If you’ve tried using TRAMP but found it too slow for your particular workflow, take a look at Hinckley’s post. His changes are easy to implement so you can try them out without a lot of effort.

Happily, my use of TRAMP mostly involves the local network or remotes connected with a high speed network so I usually don’t experience these slowdowns. Even so, it’s probably worth implementing his changes.

Posted in General | Tagged | Leave a comment

Undergrad Notes

Chris Maiorana has an interesting post on note taking with Emacs. He says that Emacs and, in particular Org mode, have all sorts of functions to make taking notes easier but that it’s easy to get bogged down in trying to decide what packages to use and how to organize your notes.

Maiorana’s suggestion is to just take notes and not worry about any details in the beginning. After you have a hundred or so notes you can worry about the best way to organize them and you’ll have a better idea of what packages you should use to take and organize them.

He has another suggestion for the type of note to take. It’s something he calls “The Undergrad Note”. The idea is that each note has

  1. A claim
  2. A quote illustrating the claim
  3. Your explanation or justification for the claim

He gives an example from Dostoyevsky’s Notes From Underground. It illustrates nicely how the method works: You make a suggestion or supposition about something, supply a quote or other evidence about the quote/claim, and, finally, offer a justification for your claim.

His post is a reminder that you can’t do it all with tools. Sometimes you need a method too. The Undergrad Note method probably won’t be a perfect fit for your needs but as Maiorana says, that doesn’t matter. The point is to get use to taking notes and discover the best method for you to do that.

Posted in General | Tagged , | Leave a comment

Running Emacs On Multiple Platforms

Many of us run Emacs on multiple platforms. Some, like me, simply run several OSs on our various computers, and some have one system type at work and another at home. Regardless, we all want a one true Emacs configuration that adapts itself to whatever system it’s running on. Using a single configuration file means that you can make additions or changes and have them reflected across all your systems. Trying to keep such changes synced across several configuration files will, believe me, end in tears

Over at The Emacs Cat, olddeuteronomy, who deals with three different operating systems, explains how he handles a single Emacs configuration for all his systems. The key to all such systems is using the Emacs variable system-type to discover what OS you’re currently running on and then conditionally executing system specific settings. Since most settings don’t depend on the system type, this makes it easy to adjust general configuration items and have them take effect across all the systems at the same time.

Rather than clutter up my init.el with a bunch of conditionals, I use the following code at the start of my init.el:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Pull in system and platform specific configurations                    ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Just keep on going if the requisite file isn't there.
;; Manipulations in second load is for "gnu/linux" → "linux"

(load (car (split-string (system-name) "\\.")) t)
(load (car (reverse (split-string (symbol-name system-type) "/"))) t)

The first statement loads a file with the same name as the computer’s name. The second loads a file with the name of the OS type. That way I can have a file, named darwin.el, with all the macOS specific settings and another for Linux specific settings. Similarly, if I need some machine specific settings—such as screen size—I simply put them in a file with the machine’s name and the settings get applied automatically. I don’t remember where I got the idea for that strategy but I’ve been using it for a long time and it works well for me.

Whatever method you use, if you’re dealing with more than one machine you probably need to adjust your init.el to handle them all seamlessly.

Posted in General | Tagged | Leave a comment

How To Live Inside Emacs

Over at the Emacs subreddit, kudikarasavasa asks a question dear to the hearts of many of us: How did you start living inside Emacs permanently? He says he keeps hearing people say they live inside Emacs and the idea seems appealing to him but he doesn’t understand how people made the journey. Did they start out to live in Emacs or was it just something that happened along the way?

Of course, it’s the answers not the question that are interesting. There are all sorts of stories. The majority of them say that living in Emacs is just something that happens after you’ve been using Emacs for a while. The usual story is something along the lines of starting to use Emacs, liking the interface, and moving all the easy tasks, coding, writing, note taking, agendas and TODO lists, and maybe even version control via Magit, into Emacs. Later, these people find, as I did, that writing and editing in other applications has become painful.

So they move “harder” applications—like email and RSS readers—into Emacs. Pretty soon, they start thinking, “why should I have to go a separate app to play music?” and they move their music playing into Emacs. Before you know it, they’re doing everything except, perhaps, browsing from within Emacs. Like me, they probably have a couple of tasks that they use other apps for—calendar, texting, and reminders for me—and that remain outside the Emacs sphere but essentially everything else is done from the comfort of Emacs.

Some of the other people are a bit more hardcore. I especially liked this quote:

The alternative journey is you read a lot of stories about Lisp, get hyped about Lisp machines, figure out that Emacs is the best you can actually get, and decide to run with it as far as you can.

I can relate.

It’s worth reading all the comments because there are several useful suggestions for dealing with things like shells and remote editing. As this post shows, it’s pretty easy to move the majority of your computer tasks into Emacs. It’s a really interesting discussion and well worth spending a few minutes reading.

Posted in General | Tagged | Leave a comment

Running All Code Blocks In An Org Subtree

If you’ve been around the Emacs technical community for a while, you know that Sacha Chua—despite being the mother of a young daughter—is an ever present and incredibly productive member of that community. One of the ways she manages that is by automating as much of her work as she can.

In a recent post she shows one such bit of automation. As almost every Org mode user knows, you can add executable code blocks to an Org file that can be executed to perform various actions, usually—but not always—altering the text of the Org file in some way. In the example that Chua gives, calendar entries are parsed and used to build crontab entries to perform certain actions in a timely manner. Chua gives the details here.

You can check out her code at the post but the aspect I want to focus on is her use of Property ID for an Org subtree. For her purposes, the ID can be used to execute every code block In the subtree. That means that she can mix various languages to build her crontab entry but execute them all with a single call to build the entry. That’s pretty neat.

The other, perhaps more useful, thing you can do with a Property ID is set an anchor point for the subtree if you export it to HTML. For example if you have a document with several subtrees—a blog post, say—that you want to publish to the Web you can have any or all of those subtrees directly addressable through a URL because the Property ID sets an anchor point for the subtree. That’s a really handy thing to know.

Posted in General | Tagged , | Leave a comment

Markdown Comes To Journelly

I’m sure you’ve all missed my Journelly posts. The thing is, it’s working so well for me that I don’t feel the need to comment about every little change but Álvaro Ramírez has just announced Markdown support. That’s nothing that I care about, of course, being a dedicated Org mode user but it’s still important.

Even if you believe, as I do, that there’s no reason for Emacs users to be slumming in the Markdown camp, there’s no reason you have to be an Emacs user to take advantage of Journelly. Indeed, other than storing it’s data in Org format there’s nothing Emacs specific about Journelly and everyone—no matter their editor choice—can take advantage of it.

And, snark aside, there are plenty of Emacs users who, for one reason or another, need or prefer to work in Markdown so this latest change will be welcome to them. Even more to the point, it shows that Ramírez is committed to Journelly and making it valuable to as many people as possible. He’s already shown this by rolling out new releases almost as fast as we can keep up with them

That brings me to another point that I haven’t mentioned before. Ramírez—who is a full time, independent, app developer—makes Journelly available for a one-time fee instead of insisting on a subscription like many developers have started doing. I really hate the subscription model and am extraordinarily grateful to Ramírez for not using it.

But for that to work, Ramírez needs to get a critical mass of users to support his continued development of Journelly. His app is great and he deserves that support so that’s why I may seem like a cheerleader for it. I use it and love and I, selfishly, want him to succeed so that Journelly will continue to evolve and get better. But even if it doesn’t, it’s still a win for me.

Posted in General | Tagged , | Leave a comment