Format$

The other day, I wrote about John Kitchin’s experiment with bringing f-strings to Elisp. In the comments, Noonian Atall pointed to Alphapapa’s format$ macro that does the same sort of thing. I just saw a reddit post from alphapappa announcing that he had enhanced format$ to include interpolated sequences just like f-strings.

The format$ macro is part of alphapappa’s elexandria library that brings some of the features of Common Lisp’s Alexandria library to Elisp. If you’re interested in f-strings, you should take a look.

Posted in General | Tagged | Leave a comment

Org Mode is Awesome

I’ve written about John Kitchin’s Org mode is awesome video before (back in 2014) but recently Xah Lee tweeted about it and I watched it again. It’s a great video and worth mentioning again for anyone who hasn’t already seen it. Actually, even if you have seen it, it’s worth watching again.

Kitchin looks at the major things you can do with Org so it’s an excellent resource for n00bs who are wondering what all the excitement is about and whether it’s worth expending the effort to learn it. You wouldn’t think there are many such n00bs left by this time but I keep seeing questions asking what it’s all about and whether it’s worth learning so apparently there are.

One of the things Kitchin mentions is Org mode speed keys. I’d forgotten all about them so rewatching the video was definitely worthwhile for me. Perhaps it will be for you too.

Posted in General | Tagged , | Leave a comment

Mastering Emacs on 26.1

Most everyone knows that you should read the NEWS file when you install a new version of Emacs. There is always a lot of new functionality and other changes that you almost certainly don’t know about. If you’re like me, though, most of it is dry and some of it you might not understand so I often don’t read it.

Fortunately, for Emacs at least, there’s a good alternative. You can read Mickey Petersen’s What’s New in Emacs 26.1. It’s really just an annotated copy of the NEWS file but it seems much easier to read and his comments provide context when it discusses unfamiliar areas.

Everyone knows about the introduction of threading by now but what other changes can you name? There’s a lot of them and you’ll probably find many of them very useful. You really should read through Mickey’s post; it’s a lot easier than trying to discover this stuff on your own.

One of the changes that is not backward compatible is apt to bite many of us. When specifying a path to a remote machine when invoking TRAMP, you now have to specify the method (/ssh:, etc.). It was optional before. Mickey gives you the workaround if you really prefer the old behavior so for that reason alone, it’s worth reading his post.

Posted in General | Tagged | Leave a comment

Emacs for Vim Users

As I’ve said before, engineers may switch between Emacs and Vim but they seldom switch from Emacs or Vim to another editor. Sure, you see folks try out the newest shiny thing—VS Code is the latest example—but somehow they always come home like the prodigal son repenting their errors. I don’t know of an easy way to move from Emacs to Vim but Evil mode, Spacemacs, and Doom make moving in the other direction pretty easy.

Mark Dawson from the Swansea Academy of Advanced Computing has a nice video that documents his transition from Vim to Emacs via Spacemacs. Like me, he was a long time Vim user and had a large investment in the muscle memory and techniques of a Vim user. By using Spacemacs, his investment in Vim is largely preserved while gaining the advantages of Emacs at the same time.

Dawson’s account is a balanced one. He notes the pros and cons of both Vim and Emacs and shows how the Vim user can almost transparently move to Emacs. Dawson cites things like extensibility to justify his switch but I think it mainly depends on what you want. If you want an editor that prioritizes text editing in the fastest, most efficient way possible and leaves unrelated tasks to other applications, then Vim is probably your best bet. If you want an almost infinitely malleable environment that integrates editing with other functions—a light-weight Lisp Machine as I like to think of it—then Emacs is for you.

If you’re currently a Vim user and think you’d like the environment that Emacs offers but are loath to abandon your investment in Vim, Dawson’s video shows you a way forward. Take a look at his video. It’s an informal presentation to his colleagues and may help you decide whether or not you want to switch.

Posted in General | Tagged | Leave a comment

JWZ on Microsoft Acquiring GitHub

There’s been a lot of chatter among the developer class about Microsoft acquiring GitHub. Most of it involves how and where to migrate repositories currently residing on GitHub.

Jamie Zawinski, for one, has no sympathy for developers who are suddenly worrying about the safety of their code. This is what happens, he says, when you store your data in the clown [sic]. He reminds us that the cloud is just someone else’s computer and that you shouldn’t be storing your data there.

I’ve said the same thing many times of course so to a first approximation, I agree with Zawinski. I would never store my only copy of data in someone else’s system. But, of course, that’s not what most GitHub users are doing. Git is, after all, a distributed VCS so project leaders or individuals who just want to share their code have their own copy of the code on their own machines. GitHub provides a convenient way of sharing code and provides an off-site backup for the code.

Some of the commenters note that GitHub provides other services, such a bug tracking, that are not reflected in the code base so those depending on GitHub and similar services do have something to lose if the service suddenly becomes unavailable. Linux, Emacs, and others solve this problem by letting git store the code while using email to manage the project so even that problem is solvable.

Project leaders—and everyone else, for that matter—should be independently backing up their own machines and, if the situation warrants, manage the project independently of the repository. If that’s happening, the project is pretty much insulated—modulo a small amount of inconvenience—from whatever the repository provider does.

As a coda, I should note that many of us who have been around for a while remember what a horrible corporate citizen Microsoft was—and possibly still is—so this post is not defending Microsoft or saying that developers are wrong to want to transition off of GitHub. I’m only saying that it’s probably not an emergency and is, in any event, an easily solvable problem.

Posted in General | Tagged | Leave a comment

Tech Addiction is Not Real

I’ve written a couple of times about the silliness that goes by the name of “tech addiction.” It’s the notion that we—and especially our children—misuse our technology and have become addicted to it. Anyone with a modicum of common sense knows instinctively that the concept is hokum.

Tech addiction’s proponents are fond of pointing to psychological studies claiming to demonstrate the addiction and its dire consequences. I’m unconvinced and so are others who have actual expertise in the issue. Via The Macalope we have this article by Psychologist Christopher J. Ferguson who’s studied the problem extensively. The article deals with 6 myths about tech addiction and concludes that there’s no such thing.

Certainly some people do spend an inordinate amount of time with their technology but Ferguson says that this is almost always a symptom of other issues not an indication of an addiction. As for the claim that using a smartphone raises dopamine levels like cocaine does, Ferguson notes that that’s true but so does any other enjoyable activity such as swimming, reading a good book, having a conversation, eating, or having sex. The thing is, these raise dopamine levels about 50–100% while drugs raise them 450–1,300%. Ferguson packs lots of facts into the article. If you’re at all concerned about tech addiction, you should definitely give it a read. It will put your mind at rest.

Posted in General | Tagged | Leave a comment

Python for Lisp Programmers

Back in 2000, Peter Norvig was getting complaints that the code in his and Stuart Russell’s book, Artificial Intelligence: A Modern Approach was in Lisp, that many of the students using the book didn’t know Lisp, and that they didn’t have time to learn it in the single term of the course. Norvig started looking around for a more “traditional” language—although I’m not sure how, other than Fortran, a language could be more traditional than Lisp—to use as a second implementation language. After a bit of investigation he determined that Python would be a good fit for the second language.

He says, “Python can be seen as a dialect of Lisp with ”traditional“ syntax (what Lisp people call ”infix“ or ”m-lisp“ syntax).” He wrote a handy page to explain Python for Lisp programmers. For various odd reasons, I’ve found myself needing to write a bit of Python lately. I used to use it a lot but stopped almost completely when I started using Lisp, Scheme, and Elisp.

His page is, therefore, really useful to me. If you’re a Lisp programmer and need to learn or refresh your knowledge of Python, this is a resource you should look at. As I say, it’s from 2000 so there’s no Python 3 coverage but it does a good job of explaining Python 2.7.

Posted in Programming | Tagged , , | Leave a comment

Video: How WeChat and Alipay Dominates Chinese Life

I’ve written several times (1, 2, 3, 4) about how China has embraced the digital life and use their smartphones for everything from paying for lunch to interacting with the government. This is made possible largely by the WeChat and Alipay apps. These apps provide a portal into every possible service and since they’re linked to the user’s bank account, it’s easy to pay for just about anything with a smartphone.

You can check out my previous posts to see how it works but there’s a nice video from the Wall Street Journal’s Moving Upstream YouTube video collection that looks at the phenomenon and talks with Naomi Wu, a well-known maker and tech person living in Shenzhen. Wu says that she does still carry some cash but only for emergencies. Duncan Turner, a westerner living and working in Shenzhen says he never carries cash and can’t remember the last time he did. He pays for everything with WeChat.

The video also explores the privacy issue. WeChat and Alipay collect a huge amount of information and know basically everything about everybody. The Chinese, though, have a different reaction to privacy concerns: they don’t really care. When one of the WSJ reporters remarks to Wu that WeChat can tell the government everything about her, she shrugs it off saying, “They already know everything about me. If I’m not committing a crime, they don’t give a shit.”

We here at Irreal are not nearly so sanguine about privacy, of course, and that attitude is probably shared by a majority of those in the West. That’s why I think it unlikely that we’ll end up with something like WeChat but I do expect to see services like Apple Pay expand and for Uber-like applications to proliferate. The difference is that there won’t be a single portal as there is in China. That will doubtless be less convenient but at least no single entity will know everything about us. Except the government. But as Wu says, they probably already know everything about us anyway.

Posted in General | Tagged | Leave a comment

A Thesaurus for Emacs

If you do your writing with Emacs rather than a “word processor,” you may have found yourself wanting an easy-to-use thesaurus that is integrated with Emacs. Even if you subscribe to John McPhee’s Draft #4 advice and mostly use a dictionary for finding just the right word, sometimes a thesaurus can be really handy.

Today, I saw an announcement by Valeriy Savchenko about his new Emacs package that provides an interface to the Power Thesaurus Website. The Power Thesaurus site is a crowd sourced thesaurus that appears to be pretty comprehensive. If you give it a word, it returns a list of synonyms. Savchenko’s package provides an easy way to query the site from within Emacs. If there is an active region, the package will use that word. If there is no region, it asks you for the word. In either case, it inserts the word at point, replacing the region if there is one. Savchenko has an animated gif that demonstrates its use.

Some of the comments to Savchenko’s announcement complained that the package depends on a third party site but that also has some advantages such as not requiring storage on your system and, being crowd sourced, always undergoing improvement. In any event, the situation is the same as with abo-abo’s define-word, which depends on Wordnik and which I use many times a day without any problems.

I’ve installed it and bound it to Hyper+p. Obviously, I don’t have much experience with it yet but it seems work as advertised.

Posted in General | Tagged | Leave a comment

Emacs 26, Threads, and Generators

One of the things that a lot of people are exited about in Emacs 26 is the introduction of basic threading. Another, less mentioned, feature is generators. The excellent Chris Wellons has a must-read post that talks about both of these innovations.

He first considers generators, which he describes as mostly modeled after Python generators and, to a lesser extent, JavaScript generators. Generators return an iterator object that performs a calculation but can stop in middle of the operation to return a value. When it’s called again, it produces the next value and stops again. Python users will be familiar with the idea.

In Elisp, the generators are implemented as closures. Wellons describes how they work and some of the gotchas involved but if you’ve ever implemented a counter function that return the next sequential integer each time it’s called, you’ll be familiar with the concept.

Next Wellons talks about the threading implementation. He says that they’re basically pthreads and that they should be considered a first step in bringing threads to Emacs. Again, he discusses some of the things that can go wrong.

Finally, being Wellons, he wrote an implementation of generators using threads. It was just a proof-of-concept implementation meant to give him some experience in using the new facilities. You can take a look at the code on GitHub if you’re interested.

As always with Wellons’ posts, I learned some new things by reading it. If you do any Elisp at all, you should take a look.

Posted in Programming | Tagged | Leave a comment