Quick Look For Emacs

A quick look at a Quick Look for Emacs from Charles Choi. MacOS has the notion of a Quick Look to peek at a file without invoking a heavier weight application such as an editor. It’s more than just dumping text onto the screen. It can deal with text, PDFs, HTML, various video files, ODF, Microsoft file types, and many others.

Choi likes the Quick Look functionality but, of course, would like to have it in Emacs too. It’s not clear how to do this in general but it’s trivially easy to do it for Dired and Ibuffer. Choi solves the problem by binding dired-display-file and ibuffer-visit-buffer-other-window-noselect to the Space key. These commands open the file in another window so they’re more than just open the file as usual in Emacs.

If you like the idea of being able to peek at a file without abandoning your current window, take a look at Choi’s post for the details on how to do it from Dired and Ibuffer windows.

Posted in General | Tagged | Leave a comment

Confirm-kill-emacs

Over at the Emacs subreddit, Danrobi1 opines that since the advent of use-short-answers, confirm-kill-emacs should be a boolean. His idea is that confirm-kill-emacs should merely specify whether to ask for confirmation or not and let use-short-answers choose the the particular form of the question if one is requested.

00-11 notes that Danrobi1 is misunderstanding the purpose of the confirm-kill-emacs variable: it was never about whether to call yes-or-no-p or y-or-n-p to ask if quitting Emacs is really what you want. What its purpose is and was is to specify a predicate that will decide whether to quit Emacs or not. There’s no reason it even has to communicate with the user. It just has to decide whether to quit or not based on whatever logic is coded into it.

I’ve had it set to y-or-n-p for as long as I can remember and haven’t thought about it in all that time. But 00-11’s response got me thinking. I originally set it to y-or-n-p because I kept inadvertently quitting Emacs by fat fingering some other shortcut and I’ve never looked back but there is one problem.

If I don’t remember to quit Emacs before rebooting my MacBook Pro, the reboot will hang waiting for Emacs to quit. That usually happens when there’s an OS update that I start off when I go to bed expecting to have a new OS in the morning only to find the system still waiting for Emacs to quit.

What if I could detect if my Mac is being rebooted? If I can, I can easily code up a predicate function that quits Emacs if so and calls y-or-n-p if not. The thought just popped into my mind so I haven’t had a chance to research it yet but it seems promising.

Posted in General | Tagged | Leave a comment

Practical Engineering

A while ago, a new site popped up in my feed. That site was Practical Engineering. I didn’t know how it got into my feed until I started to write this post. When I checked, I discovered that I was getting it from Hacker News. In any event, it’s a site that most Irreal readers will probably love.

Each post looks at some aspect of our life that is impacted by engineering. For example, the latest one to pop up was about traffic signals. You wouldn’t think there’s a lot to know but it turns out that there are significant engineering problems to be solved to get cars from one place to another.

A previous, somewhat related post dealt with how railroad crossings work. Again, you wouldn’t think there’s much to the topic but it turns out that the problem is much more complex than you think. Or there’s the post that asks Are Beavers Actually Good at Dams? (Spoiler: yes)

The posts are actually transcripts of videos from Grady Hillhouse, a civil engineer. Each post includes the video so you can simply watch them if you prefer but it’s informative to use them both. I’ve watched/read several of them and found them all entertaining and informative. They opened my eyes to some of the complexities behind everyday phenomena.

Sadly, as far as I can see, the site doesn’t have an RSS feed so you have to depend on something thing Hacker News to inform you of new posts. There is an email list that will let you know when there are new videos but an RSS feed would be a definite improvement. Take a look at a couple of the posts if you haven’t seen them before.

Posted in General | Tagged | Leave a comment

The Replacement Continues

I’ve written several times before—the latest time here— about the pernicious effect that advertising can have on a company. I’m not talking about a company advertising itself and its products. Rather, I’m referring to the increasingly common practice of allowing third parties to use their products or services to push advertisements at their hapless customers or—worse yet—the harvesting of information about those customers to sell to advertisers.

The inevitable the end of this disgusting process is that the company’s customers are replaced by the advertisers as the actual customers. Those buying their products and services become simply a product that they can sell to the advertisers.

A poster boy for this process is General Motors, which, even when faced with fierce opposition from the buyers of their vehicles, has decided to stop offering Car Play and Android Auto in their new electric vehicles. This despite compelling data suggesting that all things being equal people will chose the option with car play.

For a while it looked as if GM was backing off from those plans but now according to John Gruber reporting on a tweet from Joanna Stern on X, that is not the case. As Gruber puts it, GM CONFIRMS THEY’RE STILL SMOKING CRACK. They are doing this, of course, because they believe that they can use their proprietary multimedia system to spy on users and sell the data to advertisers.

We can only hope that GM stockholders will demand the wholesale replacement of their C-suite pour encourager les autres or that car buyers will make the decision moot by driving GM out of business.

Posted in General | Tagged | Leave a comment

Unicode Version 18.0

I’ve always been awed by Unicode and in particular its UTF-8 encoding that does the seemingly impossible: representing virtually every possible character in every language while still being compatible with ASCII. That means that UTF-8 text containing only the “standard” ASCII characters is exactly the same as the same text written in ASCII. That and the wonderful story of how Ken Thompson devised the encoding on the back of a paper placemat at dinner with Rob Pike is the stuff of legends.

Unicode itself is simply a list of numbers (code points) each of which represents a specific character or glyph. Although UTF-8 is probably the most used encoding of those code points, for some languages—such as Chinese—it makes more sense to use the UTF-16 encoding or maybe even one of the others.

In any event, languages evolve, new symbols for things like monetary units are introduced, and even new emojis are created so Unicode continues to evolve and grow. The latest version of Unicode, Version 18.0, was just released. You can see the delta of the chart index here and the new emojis here.

Unless you have a need for one of the new characters, this news probably won’t effect you very much but it’s nice to know that the standard is a living document.

Posted in General | Tagged | Leave a comment

D2 For Diagrams In Emacs

You know how people have little “eternal quests” like searching for the perfect wallet, or the perfect t-shirt, or whatever? One of mine is the perfect app for making diagrams in Emacs and Org-mode. My go to solution is Graphviz, which I always seem to end up using. It’s powerful and not too hard to use but I don’t use it enough to internalize its syntax. So I’m always on the lookout for a better way. I’ve tried a bunch of them but I always go back to Graphviz.

I just saw this video by Skybert Hacks (Torstein Krause Johansen) about using D2 for this very problem. Its syntax seems reminiscent of Graphviz but a little simpler and easier to remember. It integrates beautifully with Org-mode so it’s just perfect for writing reports, papers, notes, or blog posts.

D2 produces nice diagrams—see the Skybert Hacks’ video for some examples—and is worth trying out. I’m going to do just that the next time I need to embed some videos in one of my documents. I just saw the video so I’m not familiar with the ins and outs of the app yet but it seems worth a little effort to learn. Once I try it out, I’ll report back and let you know how it worked out.

Posted in General | Tagged , | Leave a comment

More From Watts On Markdown

My friend Watts Martin is back with some additional thoughts on Markdown. A year ago he wrote a post complaining about the ankle biters who claim you can’t do serious writing with Markdown. I responded positively to his post and noted that even though I’m all in on Org mode and use it for virtually everything I write—even iMessages through the wonderful emacs-everywhere—it’s not really a good solution unless you’re using Emacs (although some people like Karl Voit disagree).

These days, Martin is an Emacs user and does use Org mode a lot but he still prefers to write his documentation and prose in Markdown. The reason for that is partly that he’s used to it but also because he has tools to work with it and—at least in the case of documentation—has to worry about collaboration.

It’s hard to disagree with anything he says although, again, Karl Voit strongly disagrees with the assertion that neither is better than the other, even when considered solely as markup languages. Even Martin appears to agree that Org is the better tool when you can consider its normal environment.

As for the original question that got all this started, of course Markdown or Org mode can be used for serious writing as plenty of writers demonstrate everyday. It’s only the ankle biters—probably the same ones who claim em-dashes are used only by AIs—who say otherwise.

Posted in General | Tagged , , | Leave a comment

Improving Emacs Long Lines Performance

James Cherti has another excellent post in his series exploring Emacs optimizations. This one discusses improving Emacs performance on files with long lines. As those of you who have to deal with long lines know, Emacs doesn’t handle them very well and is prone to freeze while trying to render them.

One good solution for this is Phil Sainty’s excellent so-long package. The idea is that so-long detects when when Emacs is dealing with long lines and turns off certain computationally expensive features such as syntax highlighting and font-lock mode. This is a big help in speeding up Emacs’ processing of long lines but it also disables some useful features.

Cherti’s idea to to provide more granular control. For example, while syntax highlight does impose a processing penalty, it also makes code easier to read for many people. Cherti shows how to get so-long to not disable syntax highlighting.

Cherti examines several other features that can be disabled, or not, by so-long and discusses the pros and cons of doing so. He shows you how, in effect, to fine tune so-long to achieve your desired balance between performance and utility.

I really like this story because it’s a perfect example of how Emacs makes it easy to solve problems. First, there was the problem of Emacs freezing when dealing with long lines. Phil Sainty, who is not a member of the Emacs development team, helped ameliorate that problem with a third party package. Then James Cherti noticed that in certain situations you might want a less drastic effect than the default so-long action and showed how to achieve that. Even Cherti’s suggestions can be customized to suit the individual user. It’s Emacs at its best.

Posted in General | Tagged | Leave a comment

Twenty Five Years Is Enough

Twenty five years of what? As Bruce Schneier says, 25 Years of Mass Surveillance Is Enough. The post at the link is a long article with Cindy Cohn that originally appeared in Lawfare. It’s a long look at how mass surveillance—both governmental and commercial—has become institutionalized in our society. That, by itself, is a sad tale but even worse is the effect it’s had on our world.

The government, of course, conjures up its usual spectre of the Four Horsemen of the Infocalypse to justify hoovering up every bit of information about us that they can. The commercial sector, in the meantime, tries—depressingly successfully—to track our every movement through the Internet. All this in furtherance of the “targeted advertising” that follows us everywhere we go on the Internet.

But wait. There’s more. Despite the weak tea that constitutes control over the government’s intrusion into our private affairs, the 3 letter organizations feel themselves unfairly constrained and are avoiding those controls by buying information from the private sector. It’s a wonderful solution because it does away with all those pesky warrant and probably cause issues.

Schneier considers how we can reverse course. That mainly involves starting to take the 4th amendment seriously again. We can’t depend on the politicos or usual suspects for this. We have to do it ourselves. Schneier points to the Automated License Plate Reader controversy—think Flock—as an example of how that can happen. People throughout the U.S. are upset over this issue and are doing something about it. Many communities have bowed to their citizens’ fury and removed the cameras.

It’s been suggested that posts like this violate Irreal’s strict rule against covering political issues but I don’t consider this sort of thing a political issue. It’s a human rights issue and one, by the way, that just about every political persuasion feels free to violate.

Posted in General | Tagged , | Leave a comment

The Org Editor

Over at the Emacs subreddit, Low_Money_633 has a paean to Org mode. That’s nothing new, of course. Many of us are long time, devout Org mode fans. What struck me about Low_Money_633’s praise was his description of it as “the most powerful test editor”.

At first, I thought that an odd characterization. It is Emacs, after all, that is the editor. Org is simply, in Emacs parlance, a major mode. But after a little thought, I began to appreciate his characterization. If you use Emacs primarily to write prose—as opposed to code—it’s easy to think of Org mode as what Emacs is really about. Emacs is simply the foundation upon which Org is built. It’s raison d’être is to support Org mode.

The thing about writing in Org mode, as Low_Money_633 and the commenters point out, is that it’s all plain text. That means that files tens of thousands of lines long are only a few megabytes as opposed to the several gigabytes that something like Word would take. It also means that the files can live happily in something like Git where previous versions are instantly available when they’re needed.

I’ve reached the point where I write more prose than code in Emacs so I understand Low_Money_633’s point of view. That’s the thing about Emacs: it can adapt itself to be just what you need to the point that you can forget what’s happening under the covers.

As I’ve said before, when I’m writing, regardless of the type of writing, I’m almost certainly using Emacs. That’s because using anything else is too painful.

Posted in General | Tagged , | Leave a comment