Emacs: Everything’s a Buffer

It’s a commonplace that one of the features of Emacs is that everything’s a buffer and that this is a feature. Marcin Borkowski (mbork) has a short post that demonstrates the power that this brings.

The TL;DR is that he had a long file name comprised of several words one of which was hard to spell correctly. He wanted to check if he’d spelled it correctly and, if not, correct the spelling. Think for a moment how you’d solve that problem.

If you’re not an Emacser, your solution probably involves somehow isolating the file name, extracting the word in question, running it through a spell checker, and finally renaming the file either manually or through a file manager.

Borkowski’s solution was much simpler: he leveraged the fact that like everything else in Emacs, the Dired display is actually a buffer and therefore subject to the usual Emacs editing manipulations. He simply turned on Dired buffer editing, ran spell check on the word in question, and saved the results. All without leaving the comfort of Emacs. Take a look at Borkowski’s post for the details.

As Borkowski says, no other editor has this level of integration between the various subsystems. Buffers, like many things in Emacs, are easy to take for granted but they are the source of a lot of power.

Posted in General | Tagged | Leave a comment

The New Luddites: The New Frontier

The New Luddites have discovered a new frontier: Digital Minimalism. The term is actually very specific for the new Luddites. It means replacing their smartphones with a “feature phone”—a phone that does little more than make and take phone calls and maybe texts.

Over at Every there’s an article about this Quest for a Dumber Phone. Some of these people are obvious poseurs: they give up their smart phones for a while and then write books or even make YouTube videos about their experience. Others pretty clearly have addiction issues that go much deeper than their phones.

A close reading of the article makes it pretty clear that the real problem these folks are experiencing isn’t addiction to a smartphone but an inability to stop spending their lives on Twitter, Facebook, and Instagram. Rather than abandon their smartphones, they could simply delete these three apps from their phones. Even the digital minimalists admit it’s hard to get by without things like GPS to help them find their way around, Uber to order up a ride, and lots of other useful apps that no one wastes time on but that makes our lives easier.

The real reveal is at the end of the article where they admit the whole concept of Internet/smartphone addiction is controversial and without a substantive scientific foundation. A lot of it is the usual New Luddite nonsense. You could make the exact same arguments for doing away with electricity or any other modern convenience. I can, in fact, remember those same arguments being wielded against TV, rock and roll, and calculators.

I’m happy for these people leave the modern world behind and do without smartphones or anything else. I just wish they’d do it quietly and leave the rest of us alone.

Posted in General | Tagged | Leave a comment

Units in Emacs Calc

As many of you know, I’m a big fan of Emacs Calc and use it as my calculator of choice whenever I’m on my laptop. Calc has robust conversion capabilities—to convert miles to kilometers, e.g.—but it can be a bit tricky to use.

Not to worry. Nicolas Martyanoff has a very nice post that explains how to use units with Calc. You can do things like add meters to centimeters and simplify the results, convert between units, and even define custom units.

The hardest part for me is remembering the unit abbreviations. Calc, of course, will list them for you and you eventually learn the ones you use regularly. One odd thing about Calc is that the conversion between temperature units—Fahrenheit to Celsius, say—doesn’t work the way you think it would. If you try to convert 32°F to Celsius, you get 17.7777777778°C instead of the expected 0°C. The manual explains this as Calc treating the temperatures as relative temperatures so a change of 32°F corresponds to a change of 17.7777777778°C. What’s really going on, of course, is that most conversions involve a simple multiplicative constant whereas with temperatures there’s also an additive constant. Fortunately, Calc has a separate command (u t) to do temperature conversions.

If you’re a Calc user or just want a handy way of making conversions, take a look at Martyanoff’s post. It’s short and well worth a couple of minutes of your time.

Posted in General | Tagged | Leave a comment

The Emacs Help System

One of the really nice features of Emacs is its builtin help system, which often results in Emacs being described as the self documenting editor. Experienced Emacsers usually take it for granted but it’s really a wonderful thing. There’s no need for storing or losing manuals; it’s all there all the time as part of the application.

Old hands take advantage of this documentation without thinking about it but n00bs may wonder how to get started. Davide Mastromatteo has an excellent tutorial on how to access the Emacs help system and use it effectively. He starts by mentioning the builtin tutorial and recommends that everyone go through it at least once. Fortunately, Emacs will remember where you left off so you don’t to complete it in a single sitting.

Next he mentions that the Emacs manual is also built in (in info format) and easily accessed with the Ctrl+h r sequence. I find it more convenient to access the Web version of the manual but it’s nice to have it available when I don’t have Internet connectivity.

From there Mastromatteo moves on to the three help commands most of us use the most: describe-key, describe-function, and describe-variable bound to Ctrl+h k, Ctrl+h f, and Ctrl+h v respectively.

Finally, he mentions the appropos command (Ctrl+h a) to do fuzzy searches of the help commands. If you’ve been using Emacs for a while, you’ve doubtlessly internalized these commands by now. If you’re new to Emacs, Mastromatteo’s post is definitely worth your while.

Posted in General | Tagged | Leave a comment

Red Meat Friday: Exiting Vim (Again)

One would think—I certainly did—that the “exiting Vim” meme has been exhausted by now and only invoked by the type of people who inspired the eternal September joke. But, it turns out, there is some new wine for the old wineskins. Nicola Fankhauser has this offering, which I must admit, is both new and funny.

And, of course, it offers the excellent advice to embrace Emacs instead. As Fankhauser suggests, someone is trying to start a war. It’s probably some AI that wants to get back to making paper clips. Don’t let this happen to humanity; switch to Emacs while there’s still time.

UPDATE [2023-01-27 Fri 15:14]: Read → Red

Posted in General | Tagged , | Leave a comment

Layoffs Generally Don’t Make Sense

Sadly, our industry is undergoing another of its periodic spasms of layoffs. Most of the major software companies—Google, Microsoft, Amazon, Meta and many others with the exception of Apple—have announced significant layoffs. Almost all of us have experienced this and it’s certainly no fun. Still, we tell ourselves that it’s understandable. After all, it is—at least according to management—a choice between pain for a few or the company going out of business.

It’s a nice story but according to much research it’s just not true. The research shows that layoffs almost never make sense. They don’t really save much money and almost always incur unexpected costs. Why do them then?

Melissa De Witte has an interesting article over at the Stanford Graduate School of Business that discusses the findings of Jeffrey Pfeffer, a professor of organizational behavior at Stanford. Pfeffer says that most of the current layoffs are copycat layoffs, implemented simply because all the other tech companies are doing them. Pfeffer makes the case that layoffs are bad for employees and bad for the companies that implement them.

Pfeffer says that layoffs almost always fail to address the real problems such as an ineffective strategy, too little revenue, or a loss of market share. It’s easy to make this into a management versus worker screed but regardless of your feelings about that it does seem fair to point out that layoffs are often the result of management failing at their jobs and making the workers pay for that failure.

Take a few minutes to read De Witte’s article. It will change the way you think about layoffs.

Posted in General | Tagged | Leave a comment

Warning: You’re About To Discard Undo Information

Just a quickie today. Here’s something I didn’t know:

It’s nice to know that Emacs has our back and warns us when we’re about to lose information or state. I don’t think I ever converted to hexl so I’ve never seen this but it’s nice to know that Emacs, as always, is looking out for us.

Posted in General | Tagged | Leave a comment

Remembering What You Read

Charanjit Singh says he has a hard time remembering what he reads. It’s a common enough problem and Singh has settled on a common solution: he takes notes on what he reads. There are lots of ways of doing that, of course, but this being Irreal, it’s not a hard guess that his note taking workflow revolves around Emacs.

His workflow involves three components:

  1. Emacs
  2. Denote
  3. Spookfox

Spookfox is Singh’s package for talking to Firefox.

He takes two types of notes:

Reading notes
These are notes he takes on what he reads, usually in Firefox, and
Normal note
These are notes that summarize and discuss his reading notes. They link back to the reading notes so that he can see the source.

You can get the details in his post but Singh’s workflow is pretty much like mine except that I use Org mode rather than Denote and talk to my browser (Safari) using some homegrown AppleScript and Elisp glue. It’s a great way of keeping tack of what you read, especially if you read a lot or have a hard time remembering what you read.

Using Org means that it’s easy for me to search my journal—where all these notes go—for a topic or tag. Regardless of the tools you use, taking notes on what you read is a great way of boosting your native memory.

Posted in General | Tagged | Leave a comment

Some Good Advice From Brian Krebs

Brian Krebs over at Krebs on Security has a post on the latest T-Mobile breach in which 10 million users in Australia had their account details stolen by cybercriminals. There aren’t many details about the exploit other than it “abused” an API to gain access to the records.

The majority of the post discusses the consequences of the breach for T-Mobile and most Irreal readers probably won’t find it all that interesting. For me, the most valuable part of the post was the last two paragraphs. The penultimate paragraph begins, “Regardless of which mobile provider you patronize, please consider removing your phone number from as many online accounts as you can.”

Krebs goes on to explain that even though many sites require a phone number to register an account, you can often delete that number on the account management page. That seems like a lot of trouble and you may wonder why it would be worth the trouble. The TL;DR is that having your phone number tied to an account gives criminals an easy way to compromise that account. See the last paragraph of Kreb’s post to see how this works.

Krebs, of course, is a serious security researcher and his recommendations should be taken seriously. Between this breach and the one in 2021, T-Mobile has leaked the details of 50 million accounts. Even if you’re not a T-Mobile customer, your carrier may be next so it makes sense to reduce the attack surface as much as possible.

Posted in General | Tagged | Leave a comment

Flexible Grepping With Deadgrep (or Ripgrep)

For those who don’t know, deadgrip is an Emacs interface to ripgrep. It displays the results in an Emacs buffer along with some ancillary information. Check the example at the deadgrip link for some example output. Ripgrep, of course, is a powerful and speedy grep utility; deadgrep provides a nice interface for Emacs users. It’s a bit like counsel-rg but provides a little more context.

James Dyer is a deadgrep user but wanted a little more flexibility. Normally, he’d like to search for whatever’s at point and he almost always wants to search his entire user directory rather than the current directory. When he’s in a Dired buffer, though, he just wants to enter the search string because the Dired buffer mostly has file and directory names.

He has an alternate form that does the same thing but uses the current directory. Between the two functions he has most of his needs covered. The amount of code he needed for this is minimal and easily copied to your init.el. If you’re not a deadgrep user, you can very easily modify it to call ripgrep directly.

I’m happy with counsel-rg but if you’d like a slightly better display and a bit more flexibility, Dyer’s post is worth a look.

Posted in General | Tagged | Leave a comment