Emacs On The Go

It’s Sunday and nobody—especially me—feels like working so here’s a short interlude while we’re waiting for the new week to begin. The subject of today’s post falls in the broad category of what could be called “mobile Emacs”.

Most of us have wished for a way to take Emacs with us when we’re out and about. Certainly, no one would want to do any serious editing on a smart phone—although Po Lu has produced an Android port—but it’s not hard to imagine using it on an iPad or other powerful tablet.

Then there’s this guy who literally wears his computer complete with a heads up display so that he always has access to his Emacs. When I saw the video, I immediately thought of Neal Stephenson’s gargoyles from Snow Crash. It’s the exact same idea: people wearing computers—and looking odd—so they can stay continuously connected to the metaverse or what we in this world call “the net”.

As much as some of us would like to be permanently connected, I doubt that many of us are prepared to embrace the solution suggested in the video. Of course, I could be wrong and it’s just what people are looking for. Let us know what you think.

Posted in General | Tagged | Leave a comment

How To Speed Up Emacs

Over at the Emacs subredit, iinnssdd says he was looking for a guide to speed up Emacs but couldn’t find one. Therefore, he put together his own. This is more than the usual “how to make Emacs load faster” article, which we all know are silly and a waste of time. Although there are some suggestions for making Emacs load faster, the useful parts are how to make Emacs run faster once it’s loaded.

Some of that are compile time options when building Emacs from source. Iinnssdd’s particular options may or may not apply to your situation but they’re worth taking a look at. Another obvious strategy is to make sure that you have native compilation enabled. Iinnssdd has some suggestions for that.

A couple of specific recommendations are applicable to many of us. They’re both pretty simple and easy to implement. The first is a hook function to the find-file function that looks at how many lines the function has and turns off display-lne-numbers-mode when there are more than 1000 lines. It’s easy to see why this would speed things up on large files.

The second speedup is similar. It’s another find-file hook that looks for C files that have more than 1000 lines and turns on simpc-mode when it finds one. Simpc performs minimal syntax highlighting and indentation and, according to its author, is much faster than c-mode, c++-mode, cc-mode, and so on.

Even though I don’t have native compilation enabled on my older MacBook (2019), I still don’t find Emacs insufferably slow. That could be one of the benefits of having grown up with much older computers that were really slow. Regardless, if you’re intent on squeezing every bit of performance from Emacs, Iinnssdd’s post may give you some ideas.

Posted in General | Tagged | Leave a comment

Librephone

I just saw this announcement about the Librephone from the FSF. The idea is to provide a replacement for the Android smartphone operating system that would be free and open and not vacuum up everything you do with your phone the way Google’s Android OS does.

It’s easy to dismiss this. We’re always seeing some startup claiming to be producing the latest iPhone or Android killer but these “killers” always slip beneath the waves unfulfilled and never to be seen again. At the end of the day, we’re left, as always, with the iPhone and the Android phones,

On the other hand, I remember when the GNU project was announced and thinking that it was a pipe dream that would never succeed. We all know how that prediction turned out. GNU has eaten a large part of the software world and even the parts that it hasn’t swallowed whole still depend on software from the GNU project.

GNU really did change the world so only a fool would dismiss their efforts. In a way, they’re perfectly positioned. They don’t have to worry about developing hardware, dealing with cell carriers, and government agencies, or any of the other hard stuff. Their idea, as I understand it, is to provide a drop-in replacement for the existing Android operating system.

To be sure, the entrenched surveillance industry that abuses the Android system will resist these efforts just as Microsoft and others strenuously resisted Linux and the free software movement. Still, it would be foolish to dismiss Librephone’s efforts out of hand. It will be interesting to see how things play out. The FSF has recruited some very talented people to work on the project so the technical aspects are probably well in hand. I’d guess the major problems will be political and marketing. Unlike GNU, Librephone is aimed at a wider market than just the nerds and that may require winning over the man on the street.

Posted in General | Tagged | Leave a comment

Bending Emacs 3: Git Clone

One of the nice things about Emacs is that when you find yourself performing the same set of steps repeatedly, it’s easy to capture those steps into an Emacs function or even a keyboard macro. If you’re like me, you’ll keep repeating those steps over and over until one day you realize that you really should automate them. Álvaro Ramírez has a video showing a nice example of this: cloning a git repository.

Ramírez begins his video by showing his old procedure. It’s really simple. Capture the URL to the clipboard, change into the target directory, paste the URL into a git clone command on the Eshell command line, execute it, and open the directory in Dired. If there’s a README, open it as the last step. It takes longer to write it down than it does to actually do it.

Still, they’re simple steps and easy to automate, which is what Ramírez did. His solution is nice. He just has to capture the URL and call his function. Everything else, including opening the README file is handled automatically. He has a bit of code to allow choosing the target directory if he doesn’t want to use the current directory. You can check out his code in his GitHub repository. It is, as I say, simple but it’s a nice example of removing friction from your workflow: just let Emacs handle the routine chores.

The video is only 6 minutes, 54 seconds long so you should have no problem finding time for it. It’s interesting and worth a few minutes of your time.

Posted in General | Tagged | Leave a comment

The Vacuum From Hell

I really like the idea of a smart home. The Irreal bunker hasn’t gone crazy but we do have our TV, many of our lights, our security camera, and our front door locks integrated into the Apple Smart Home environment. One conspicuously missing item is a smart vacuum cleaner. The allure is palpable: set it up once and never worry about vacuuming your floors again.

Still, I keep hearing stories about how these devices send data, including a map of your house, back to the mother ship. On the one hand, it’s easy to understand collecting some mapping data to help guide the cleaner but why would you need to do it more than once and why couldn’t this data be handled locally on the device? Really, what reason is there for the device to be talking to remote servers regularly? It’s easy to dismiss a lot of this as coming from the tin foil hat brigade but it’s always made me wary.

Now Code Tiger over at Small World provides us with some persuasive data. He is, as he says, a bit paranoid so he decided to monitor his vacuum’s network traffic. He noticed that his vacuum cleaner was constantly communicating with a server half way across the world, as he put it, transmitting logs and telemetry that he hadn’t consented to share.

So he decided to block the logs and telemetry. In a few days, it refused to power on. He took it to the repair center and it worked fine. When he brought it home it would work for a short time and then refuse to power on again. After a few iterations of this, the repair center refused to work on it any longer.
It turns out that Code Tiger is not merely a software guy but also knows a lot about hardware. So he took his vacuum cleaner apart of figured out exactly how it worked. That means what every sensor, chip, and component did. He also discovered that the whole thing was a Linux system and, shockingly, that it was possible to log into the system. You can read the details on his post but the TL;DR is that the mother ship had sent a kill command bricking the cleaner in revenge for his blocking its surveillance.

Since he had access to the system, that was easily reversed and now his vacuum cleaner is happily cleaning his floors without the need to phone home. The whole thing reminds me of the old joke that even the paranoid have enemies.

Posted in General | Tagged | Leave a comment

Medicated Emacs

If you’ve been around Irreal for a while you know that we here in the Irreal bunker have never felt the need for a starter kit. A lot of that is probably due to the fact that they weren’t generally available when I moved to Emacs. I just started with an empty config and began adding things—sensible scrolling, C indentation, and a couple of other necessities—right off the bat. Other changes and additions came later.

Those initial changes are instructive. There were, of course, reasonable defaults for all of them, they just weren’t what I wanted and that’s also the problem with starter kits: they have their own idea of the right thing and it may differ from yours.

Still, when you’re starting out it’s nice to have a way of establishing a reasonable initial Emacs environment even if it’s not exactly what you want. If you do that, it’s important, I think, that the starter kit be easily modifiable. A nice example of this is medicated-emacs, a minimal configuration that’s easily adaptable. Take a look. It mostly set’s a few configuration variables and loads a few select packages.

You probably won’t agree with all these choices. I certainly don’t but the thing is, they’re easy to change. The configuration variables were set with the custom package so they’re easy to change if you want to. You may not want all the packages medicated-emacs loads. For instance, I have no need for rust-mode but it doesn’t hurt to have them there in the short term and after you learn a little more about what you’re doing, you can simply remove the package from the config.

If you’re a beginner and think a simple, non-opinionated configuration would be helpful, take a look at medicated-emacs. It will get you going and will be easy to adapt to your evolving needs.

Posted in General | Tagged | Leave a comment

Should We Stop Avoiding Politics?

If you’re familiar with Betteridge’s law of headlines you know that the answer is “no”. Every engineer recognizes politics for what it is: A process used by the unscrupulous to achieve ends that benefit no one but themselves and their cohorts. This is glaringly clear on the national level where politicians will do things against the public weal or even against their own interests simply to prevent their political enemies from benefiting.

Politics operates everywhere, of course, even within engineering departments. Over at Terrible Software, Matheus Lima has a post arguing that we, as engineers, should Stop Avoiding Politics. After all, he says, politics is just how people coordinate in groups and get things done.

Did you see the slight of hand? This is a redefinition of what most of us mean by “politics”. It’s used, mostly by politicians, to obscure what’s really going on. Regular people understand politics as the corrupt process I described above not as the everyday interaction between people that Lima describes as politics. Eschewing politics doesn’t mean refusing to interact with your colleagues or refusing to offer your opinions, it means not indulging in Machiavellian machinations to achieve your desired ends even if they’re arguable good.

If we did the things that Lima describes, we’d all be better off and things would move more smoothly but let’s not pretend that doing so makes us politicians. It just makes us something other than jerks.

I get the point that Lima is making. It’s important for us to engage and offer our best opinions about important issues but that doesn’t make us politicians or mean we’re practicing politics in the generally accepted sense of the word.

Posted in General | Tagged | Leave a comment

RSS Readers

Following up on my recent posts about RSS [1, 2] here’s an article on everything (and probably more) that you ever wanted to know about RSS readers. It turns out that there’s all sorts of readers: paid, hosted, self hosted, on device, browser based, and more.

The article considers readers along two axes:

Deployment Mode
on device, browser extension, hosted, self hosted
Business Model
free, one time fee, subscription

In other words, where the data is stored and how much you pay. The article looks at over 30 RSS readers, classifies them according to the two axis, and briefly describes many of them.

They don’t, of course, talk about the best feed reader, elfeed. That’s understandable. Not even I would expect someone to adopt Emacs just for an RSS reader. I’ve used Reeder and Feedly and they were fine. When I used it, Reeder was free but is paid now. Feedly was always paid but I have a lifetime subscription from getting in early. They’re both hosted solutions

For me, elfeed hits to sweet spot. It’s free, on device, has a ton of features, and since it’s open source can be customized as needed. If you’re an Emacs user, you really should be using it. And who knows, maybe Org mode, magit, and elfeed will be enough to get you to give Emacs a try.

In any event, if you’re looking for an RSS reader, this is a useful article to find out what’s available and what their capabilities are.

Posted in General | Tagged , | Leave a comment

Using Eshell To Output To A Buffer

As many of you know, your can output to a buffer directly from within Eshell by redirecting the output to a #<buffer ...> structure like this

Welcome to the Emacs shell

~/org/blog $ echo "Hello World!" > #<buffer hello-buffer>

That naming convention may seem weird but it’s exactly how Emacs refers to buffers. As Christian Tietze says in this post about redirecting output to a buffer you can see this by executing the current-buffer command (it’s not an interactive function so you have to call it as (current-buffer) in some Elisp context).

Tietze covers all this in his post but the interesting thing is that he hates having to remember and type the #<buffer ...> structure. I can sympathize. I got it wrong at least once while preparing this post. Tietze has the solution. He wrote a function, new-buffer, that generates a temporary buffer and returns it just as if you had specified it with the buffer notation. Then he can write Hello World! into a temporary buffer like this

Welcome to the Emacs shell

~/org/blog $ echo "Hello World!" > (new-buffer)

That’s a bit easier to remember and less clumsy to type than the #<buffer ...> construct.

Of course, as Tietze says, all this makes sense only if you’re already in Eshell. Otherwise, you can achieve the same result by simply using shell-command or async-shell-command. Regardless, Tietze’s post is interesting and worth a couple minutes of your time.

Posted in General | Tagged | Leave a comment

Red Meat Friday: Emacs Startup Time Again

I’ve come realize that, sadly, I’m addicted to posts about Emacs startup time. Every healthy person knows that Emacs startup time doesn’t matter. That’s because, of course, experienced Emacs users seldom restart their editor. They just leave it running all the time. Some, like me, just have it running in a dedicated work area, others run Emacs in server mode and invoke it when needed by calling emacsclient.

Everyone knows all this so you’d think that we’d all get on with our lives and stop worrying about Emacs startup time. We don’t, of course. As soon as I saw this post by No_Cartographer1492 over at the Emacs subreddit, I had to jump in. It’s not that Cartographer1492’s post was objectionable. He was just trying to figure out how to structure his configuration for minimum startup time. There’s nothing wrong with that but whatever figure he announces you can be sure that someone else will announce that their Emacs loads a tenth of a second faster and we’re off to the races.

The best answer was from Lalylulelo who simply observed that they stopped worrying about startup time the day they discovered server mode and emacsclient. But really, you don’t even need that. Only the realization that you can simply leave Emacs running and only restart it when you reboot the system and update Emacs and that tenths of seconds or even tens of seconds in the startup time just don’t matter.

So please, help me get better by not writing about Emacs startup time. We all know that except in special circumstances it simply doesn’t matter. You might like to pretend it does but it doesn’t.

Posted in General | Tagged , | Leave a comment