Some Notes On The Culture

Virtually everyone here knows that I’m a huge fan of Iain M Banks’ Culture novels. Indeed, the name “Irreal” comes from an idea in his 1996 novel, Excession. I’ve read all the Culture novels except the last one, which I’m saving to savor at a later time given that Banks died tragically young and the series came to an end.

I just came across these notes on the Culture from Banks. In them, he lays out a mostly complete world view of the Culture and how it operates. Considering that the Culture is, after all, a fictional entity, it’s an amazing complete and coherent description. Even if you’ve haven’t read all the novels—or maybe especially if you have read all the novels—you should take a look at this. It’s long but discusses lots of things that you may have missed when you read the novels.

Banks’ essay is hosted on Trevor Hopkins site, which also lists 3 novels and several short stories that he’s written that take place in the Culture universe. I just found his site so I haven’t had a chance to read any of his stories yet but I’m hopeful that they’ll feed my appetite for Culture stories.

As I’ve said many times before, if you like Science Fiction you should definitely read these novels. They describe a universe in which I, at least, would love to live. In the Culture you can do pretty much whatever you want and the society takes pains to prevent those with a will to power from gaining it. What’s not to like.

Posted in General | Tagged | Leave a comment

Org For Writing And More

Aditya Athalye has a nice post on how he uses Org-mode for writing and more. Like most Org users he started using it for a single task and discovered, as he went along, that he could also use it for other tasks.

Like me, his main use is writing. He writes his blog, his talks and most everything else in Org. As I’ve said many times before, I hate writing in anything else. The thing about Org—when run natively in Emacs—is that you get all the advantages of Org markup along with the superior editing environment provided by Emacs. I would use Org even without Emacs but I wouldn’t enjoy it nearly as much.

As Perry Metzger recently said in an Irreal comment, Emacs really does provide a superior editing environment that makes editing text much easier than in other editors. If your priority is efficient text entry and editing rather than bling, it’s a no-brainer. Take a look at Metzger’s comment for one of many reasons why.

Athalye considers, among other things, why you should use Org markup instead of Markdown. Both are way better than the WYSIWYG editors but Org is I think the better alternative. Karl Voit agrees. One of the main ways that it’s better is Babel and the way it enables “live documents” that rewrite themselves when the data they describe changes.

Another advantage is that’s there’s only one Org whereas there are several flavors of Markdown. This is mainly due to the tight coupling of Org markup with Emacs and could change if Org markup obtains enough traction in other editors. That’s why Voit, at the above link, argues for a standardized Org markup that’s the same with every editor.

If you want to see some good reasons for why the effort of learning Org is worthwhile, take a look at Athalye’s post.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: A Poetic Incursion Into The Editor Wars

Here’s a bit of Friday Red Meat for all you Emacs partisans in the eternal editor holy war.

Before you flame me, please keep in mind that I was a long time Vim user and often write approvingly of it. As I’ve often said, these days the editor wars are more about comic relief than a serious dispute. The real point of contention is not the editors themselves but the workflow that they engender.

Some people want a Lisp Machine, others want a small, fast, editor that’s good at editing and nothing more. The nice thing is that the Emacs/Vim duopoly lets you choose the environment most comfortable to you.

Anyway, enjoy the short diversion and get back to work. After all, we all have serious matters to deal with.

Posted in General | Tagged , | Leave a comment

Emacs Pretest 30.0.91

Andrea Corallo has just announced that the first Emacs 30 pretest (30.0.91) is available for download and testing. You can check the NEWS file to see what’s new in the release.

As always, thanks to Eli, Andrea, and all the other devs who worked so hard to bring us this release and who keep Emacs a vital and thriving enterprise. The release of this pretest means that the release cycle for Emacs 30 is underway and we can expect the first release candidate sometime soon depending on how many errors are discovered in 30.0.91.

The developers depend on the Emacs community to help find those errors so if you can, please download and test the new version. It will help us all and move Emacs 30 closer to the official release.

Posted in General | Tagged | Leave a comment

Casual Symbol Overlay

A couple of months ago, I wrote about Álvaro Ramírez’s gluing together of Symbol Overlay and Multiple Cursors. I was really taken with Symbol Overlay and its ability to select a given symbol for further actions. There are many possible operations and symbol-overlay lets you define your own commands for them. Of course, those commands are going to be hard to remember so it’s a perfect candidate for one of Charles Choi’s Casual apps.

Choi has, of course, stepped up to that challenge with Casual Symbol Overlay. As usual, it provides a Transient menu for those commands that you can invoke at will. You don’t, of course, have to use the menu. If you use a given command enough to remember it, you just use it but if you can’t remember the command, you can just invoke the menu and execute the command from there. It’s the best of both worlds.

At this point, I’ve just about decided to install Casual Suite so that I get all the Casual apps. You still have to configure them so they won’t be loaded unless you want them but Choi is making additions so often that it makes sense to reduce the friction of adding them. I don’t want them all but I do want a lot of them so it makes sense to add them all to my ELPA repository and configure the ones I actually want to be available.

Posted in General | Tagged | Leave a comment

Branch Prediction

Here’s a very nice discussion of branch prediction from a Stack Overflow question. We graybeards and, really, just about everyone else like to pretend that all processors are still like the PDP-11. They were easy to understand and their semantics easy to assimilate.

Modern processors are nothing like them, of course. Instead of a linear pipeline of instructions executed sequentially, modern processors like to gamble. They look ahead in the instruction stream and precalculate results so they’re ready when they’re needed. The difficulty arises when there’s a branch. What should the look ahead procedure do? Should it take the left fork or the right one.

It’s a difficult problem but there are, in fact, some effective procedures. It basically boils down to noticing what the average behavior is and betting on that. If the behavior is reasonably normal, the results are good. Most times the processor guesses right and there’s no reason to stop everything and back up like there is when the processor guesses wrong.

If you’re writing in Python or a similar high-level language, there’s no reason to worry about this. But if you’re writing in C, or some other low-level language, this is something you sometimes have to take into account.

Happily, most of us don’t have to worry about such things but it’s worth knowing that the problem exists if only to have them in the back of our minds as we write our code.

Posted in General | Tagged | Leave a comment

Babel and Python

This is a sort of Public Service Announcement. One of the great things about Org mode is the code block where you can run code in an Org buffer and have the results inserted into the Org document. I use this all the time. It’s a particularly elegant way of practicing literate programming and writing “live” documents that automatically rewrite themselves when the data the changes.

It’s usually a seamless process but there are gotchas for some languages. Sadly, Python, a widely used language, is one of those where you have to be careful. If you don’t follow the rules correctly, you can end up with erroneous results.

Recently, on the Org Mode mailing list there was a nice discussion of the problems that Python can present. As of right now, there are only three posts in the thread so you should read them all to get a full idea of what’s going on. The TL;DR is that you (usually) have to provide an explicit return in your Python code to get the correct results into your Org buffer.

Python is the only language that I use—even occasionally—that has these problems: usually things just work. It is, therefore, worth spending a few minutes familiarizing yourself with the problems that Python and a few other languages have in the Babel environment.

Posted in General | Tagged , | Leave a comment

Using .authinfo With Org Code Blocks

As most of you know, I’m a big fan of using literate programming techniques in the context of what might be described as “devops”. The technique boils down to writing an Org file with code blocks that document how you are solving a particular problem. The key is that the code blocks are executable and are what you actually use to solve the problem. Howard Abrams has a really good introduction to the idea in a post and subsequent video.

Magnus Therning has a nice nice post that expands on the same theme. His wrinkle is that the applications he’s interacting with require login credentials. For a long time, he simply kept those credentials as plain text in his Org file but, of course, he realized that was a bad thing.

He solved the problem by putting his credentials in his .authinfo file and accessing them with the auth-source library. He wrote a couple of functions that used the auth-source library to retrieve the necessary credentials. He populated these in a properties block. This is perfect because the source code doesn’t show any secrets but those secrets are made available to the executing code.

I do something similar to retrieve secrets that I don’t want exposed in plain text. The .authinfo file and associated library is a really useful set of tools to enable access to secure applications without exposing the required credentials. Take a look at his post to see how easy it is.

Posted in General | Tagged , | Leave a comment

Converting Between Miles and Kilometers

Peteris Krumins has a nice post on using Fibonacci numbers to covert between miles and kilometers. The TL;DR is that if you take any two consecutive Fibonacci numbers, X and Y, there will be approximately Y kilometers in X miles (and vice versa, of course). The approximations are amazingly precise.

There’s more. The above works only if the number you want to convert is a Fibonacci number but you can express the number you do want to convert as a sum of Fibonacci numbers and sum up the corresponding pair numbers to get the conversion. Take a look at Krumins’ post for an example.

It’s not an accident that it works, of course. The secret is the ratio of consecutive Fibonacci numbers, \(F_{n+1} / F_{n}\) converges to the Golden Ratio, \(\frac {1+\sqrt{5}} {2} \approx 1.618034\). The key is that there are 1.609344 kilometers per mile, which is very close to the Golden ratio.

Serendipitously, John Cook, a Mathematician, has a recent post on the same subject. He makes an interesting observation. The higher the value of n the closer \(F_{n+1} / F_{n}\) gets to the Golden Ratio so, naively, one expects the kilometer-mile approximation to get better too. That works for a while, but for larger n, the \(F_{n+1} / F_{n}\) ratio gets closer to the Golden Ratio than the number of kilometers per mile. Cook calculates where the ratio is the best approximation to kilometers per mile and, surprisingly, it’s at 21/13, a lower number than I would have expected.

Cook also mentions Lucas numbers, which are very similar to Fibonacci numbers except for the starting values. It turns out that Lucas numbers provide an even better approximation but, really, both methods are back of the envelope approximations so who cares.

Perhaps I find this interesting only because I’m a Mathematician but I’m pretty certain the average Irreal reader will find it so too.

Posted in General | Tagged | Leave a comment

🥩 Red Meat Friday: Should You Replace Emacs With An “AI Editor”?

Over at the Emacs subreddit, harmanola, an Emacs user of 16 years, says that he’s recently switched from Emacs to Cursor, the AI code editor. It’s his opinion that Emacs has become unstable, that he’s tired of its “non-standard defaults”, that AI can increase his productivity by 5 times, that Emacs doesn’t scale, and that its developers aren’t on Discord. He also thinks that Emacs might be history soon.

One hardly knows where to begin. Well, I may not but the commenters certainly do. If there was ever a legitimate point to harmanola’s post, it got demolished by one or more of the commenters. To me, the silliest of his arguments is that one needs an “AI editor” to be productive. It seems to me that the AI suggestions are usually just slightly better than the code generated by previous editors that offered to write code for you: great for folks who are mostly generating boilerplate but used by virtually no one else.

The silliness about the Emacs developers not being on Discord strikes me as revealing a sense of entitlement: “I would like your help but I don’t want to go where you give it; please come over here instead.” If you spend 10 minutes on the Emacs mailing list you can’t help but be impressed by how much time guys like Eli Zaretskii spend—for free—on Emacs. As one of the commenters noted, all the things that comprise a healthy development environment—bug fixes, responding to pull requests, and regular updates—are, in fact, happening.

I’m sorry to see harmanola abandon Emacs and I hope he finds happiness elsewhere but his arguments for why we should leave Emacs for an AI editor just don’t withstand scrutiny.

Posted in General | Tagged , | Leave a comment