Emacscalc Script

I’ve often written about how powerful and useful Emacs calc can be1. It is, I think, one of the most underrated features of Emacs. It’s a bit hard to learn, not because its default data entry mode is RPN but because it’s so powerful and has so many functions. I’ve sometimes described it as “a poor man’s Mathematica.” That comparison is overblown, of course, but for most people, calc can do everything that they’re apt to need in the way of mathematical calculations.

Christoffer Stjernlöf has a cute trick: he’s released a shell script that lets you run calc without explicitly opening Emacs. It works just the way you’d think it would. It starts Emacs in the background and calls calc from the command line. A very nice little hack.

It’s great for people who aren’t Emacs users but would like to take advantage of calc’s power. You don’t need to know any Emacs arcana to use calc so that’s a valid use case. On the other hand, I’m not sure how useful it is for Emacs users. Most of us always have Emacs running and many of us have a shortcut to start up calc. For example, I have F10 mapped to calc-dispatch so a single key starts calc for me.

Still, I’m sure there are people, some of them Emacs users, who will find the script useful. If you aren’t already a calc user you really should become one. You’ll find it worth the effort, I promise.

Footnotes:

1

There’s too many to list. Do a search on “emacs calc” to get an idea of how often I’ve written about it. Even I was surprised at the number of posts involving calc.

Posted in General | Tagged | Leave a comment

Can A Programming Language Be Too Powerful?

After writing my post on Emacs and Igors, I reread Rudolf Winestock’s The Lisp Curse that Done mentioned in his article on why Emacs users are like the Igors. Winestock’s article, in turn, mentioned another that I’ve also read before, Mark Tarver’s The Bipolar Lisp Programmer. It’s been many years since I’ve read either and I was very resistant to The Bipolar Lisp Programmer the first time I read it so I probably didn’t get as much out of it as I should have. On rereading them, I have to admit that they have a point.

That brings us to the title of today’s post. According to Betteridge’s Law the answer should be no but Winestock and Tarver make the case that Lisp is so powerful that its practitioners and their community are harmed. That’s a provocative claim so it’s worth taking a look at why Winestock and Tarver think it’s true.

The first question to consider is whether it’s true that one reasonable1 language can be more powerful than another. You might think that maybe the differences aren’t all that pronounced but Winestock suggests a thought experiment. Take the two languages C and Scheme, neither of which have object support, and consider how hard it would be to implement objects while maintaining backward compatibility with the original language. As Winestock says, it’s little more than a homework assignment for Scheme but takes significant programming chops to do it in C. So, okay, Lisp does seem more powerful in many ways.

But why would that be harmful? The problem according to Winestock is that every programmer “does it himself” and you end up with lots of implementations of whatever feature is being added none of which are entirely satisfactory to anyone but the implementer. That leads to programmer isolation and, often, the lack of standard implementations of many features.

Tarver takes this idea a bit further and says that the power of Lisp is especially harmful to a certain type of programmer that he describes as having a brilliant bipolar mind. His argument is a bit nuanced and you should read his article to appreciate it fully. In fact, read both articles. They’re thought provoking and interesting. Especially if you’re a Lisper.

Footnotes:

1

We’re not talking, for instance, about whether C is more powerful than, say, the original BASIC.

Posted in General | Tagged | Leave a comment

Adversarial Interoperability

Over at boingboing, Cory Doctorow has an excellent essay on adversarial interoperability, or as he puts it, How about nah? The central theme of the piece is the idea that Web sites are offering a one sided deal: “Let us and everyone we do business with track you in every way possible or get lost[.]” It’s meant to be a take it or leave proposition. Agree to this or leave the premises.

As Doctorow says, consumers are saying, “Nah, I don’t think so. I’ll just use an ad blocker and stop the tracking at its source.” This is what he means by adversarial interoperability. The users have found a way to use (or interoperate with) the Web sites in a way not envisioned or approved by the sites’ owners. The owners, of course, respond with ad blocker blockers—software that detects if an ad blocker is operating and refuses to render the site if so. The users respond with ad blocker blocker blockers and so on.

The larger point of the essay is that until now, there was little that the advertisers could do—although they certainly tried—to stop this. Now, however, the W3C has sold users out by standardizing and lending their imprimatur to the Encrypted Media Extensions. Once implemented, advertisers will be able wrest control from the users by leveraging the Digital Millennium Copyright Act to punish anyone who tries to subvert it.

I don’t know if things are as bleak as Doctorow portrays them but it certainly isn’t good. Of course, politicians famously refuse to stay bought and if there’s enough outcry, perhaps they’ll get serious about privacy legislation. Or not. Who knows? In any event, Doctorow’s essay is very much worth reading.

Posted in General | Tagged | Leave a comment

Org Mode 9.2.5 Is Released

Bastien says it’s a bug fix release so if you’re having any problems with Org you should consider updating.

Posted in General | Tagged , | Leave a comment

An Interesting Emacs User

I didn’t feel much like working on an Irreal post today so I procrastinated by surfing over to Lifehacker and wasting some time there. Besides the sometimes helpful tips on handling some of life’s chores, they have a section called How I Work that features an interview with a well-known or interesting person about (basically) their workflow.

A recent interview was with Courtney Napoles, a computer scientist who heads Grammarly’s Language Data team. She has an interesting background that includes working as a book editor before she decided to switch gears and get her doctorate in Computer Science. That’s sort of interesting but why would the average Irreal reader care?

It turns out that Napoles, like many of us, is a dedicated Emacs user, of which she says, she would be almost paralyzed at work without. Like me, she uses it for everything: for work, for keeping her and her child’s schedule, notes, TODO lists, shopping lists and just about every other text related thing.

The other thing that struck me was her answer to the question “What’s your favorite shortcut or hack?” She mentions two things sure to strike a chord with hardcore Emacsers. She says that she avoids using the mouse as much as she can and tries to do everything from the keyboard. Along with that, she has a large set of keyboard shortcuts so that she can avoid clicking on an icon to start an app. I never considered that I was a big keyboard shortcut user but after reading the interview, I realized that I use shortcuts the same way she does. I have function keys programmed to start all of my usual applications and to do things like open an Org-mode capture template recording the current URL when I’m in the browser. It’s amazing how much time and effort you can save just by making a few such shortcuts.

If you’re looking for a way to avoid doing what you’re supposed to be doing—or even if you’d simply like to read an interesting interview—head over to Lifehacker and take a look. The two interviews after Napoles’ are with Kirsten Vangsness of Criminal Minds and Will Shortz, the New York Times Crossword Puzzle editor. There’s something for everyone.

Posted in General | Tagged | Leave a comment

Emacs Users…

The few, the proud, The Emacs Users!

Posted in General | Tagged | Leave a comment

Emacs Users Are Igors

The other day, I saw a tweet pointing at a post from 2013 by Chris Done. It was sort of interesting so I added it to my blog queue. Since then, I’ve seen several more tweets mentioning it so perhaps everyone has seen it by now. Just in case you missed it, the post’s theme was that Emacs users are like Terry Pratchett’s Igor Clan.

Igors were characters from Pratchett’s Discworld series who were experts at surgery and routinely replaced their own body parts, making repairs and improvements. That last phrase should tell you why Done thinks Emacs users are like the Igors: they are always changing and improving their editor in the same way that the Igors are always changing and improving themselves.

His thesis is that because Emacs has an extension language in which the majority of the system is written, it’s easy for each user to move things around, modify parts, and add new things to suit themselves. He says that the Rudolf Winestock’s famous Lisp Curse—Lisp’s extraordinarily expressive power leads to programmer isolation—doesn’t apply to Emacs because, after all, your editing environment is yours alone and doesn’t have to satisfy anyone but yourself.

Done’s experience is much like mine: he came to Emacs from Common Lisp and came to see it not as an editor but as a programming environment—or as I like to say, a light weight Lisp Machine. While I don’t have any interest in routinely rearranging my body parts, I do enjoy doing it to my editor.

Posted in General | Tagged | Leave a comment

MAlt: CERN Strikes a Blow for Open Source

Microsoft has been a sleeping dragon lately. Those who haven’t been around for more than, say, 10 years probably don’t remember how ferocious and predatory they were. Still, to mangle a metaphor, the dragon hasn’t really changed his scales.

For years, CERN was counted as an academic/research institution—which it certainly is—by Microsoft, and as such were granted favorable terms in the licensing fees they paid for Microsoft software. But just because Microsoft has put on a friendlier face lately doesn’t mean that much has changed. Last year they informed CERN that they were revoking its academic/research status and that going forward per seat licensing would apply. That left CERN looking at a ten-fold increase in what they paid to Microsoft.

CERN did two things. First, they negotiated a ten year ramp-up in the fees but more importantly, they initiated the Microsoft Alternative (MAlt) Project. The idea was to migrate CERN off of Microsoft, and other proprietary, software in favor of open source. Their objectives were to

  • Deliver the same service to every category of CERN personnel
  • Avoid vendor lock-in to decrease risk and dependency
  • Keep hands on the data
  • Address the common use-cases

Keeping costs under control is vital for any institution, especially a public institution, of course but to my way of thinking the big win is keeping control of their data. They own it, can store it locally, and don’t have to worry about what some vendor may decide to do in the future. That goes hand-in-hand with avoiding vendor lock-in so it’s an important thing.

If Microsoft thought they were going to be able to squeeze a few more Euros from CERN, they were mistaken. Instead of more Euros they will be getting fewer customers.

Posted in General | Tagged , | Leave a comment

Building an Emacs Mode to Improve Your Workflow

Adrien Brochard gave an excellent talk to the New York Emacs Meetup in which he demonstrates how to build an Emacs major mode to improve a workflow. Brochard is working with Kubernetes and would like a way to look at—or even tail and follow—the logs. For those who don’t know what Kubernetes does, or perhaps have never heard of it, it’s a system for controlling a set of processes (called pods).

Kubernetes, of course, has a way of displaying and tailing the logs but you first have to call a Kubernetes command to list all the pods, which have long, complicated names, and then cut and paste the name into another Kubernetes command to list the log. Brochard wanted an easier workflow that didn’t involve leaving Emacs or using the mouse. His solution is Kubernetes mode.

What I really like about the talk is that he incrementally builds up his solution in much the same way that Kris Jenkins did when building his Spotify client. He starts in the shell showing us how to call Kubernetes to list the pods and get the logs, then he writes a bit of Emacs code to call the code and put the results in a buffer using shell-command-to-string, and then split-string to get a (Lisp) list of pods.

Next he wants a way of picking the correct pod. I probably would have used ivy-completing-read or one of its brethren but Brochard chose to use tabulated-list-mode, which makes sense for him because he is going to derive Kubernetes mode from tabulated-list-mode. By combining this with his previous code to get the list of pods, he has a naive version of the desired workflow. The problem is that large files can hang Emacs while they’re being collected and, of course, trying to tail and follow the log will lock everything up. He solves that by substituting call-process and start-process (depending on whether he wants to tail or not) for shell-command-to-string. Now he a workflow with good performance and that supports tailing the log.

Finally, he uses transient from Magit to wrap his mode up in a nice UX. Again, he does this incrementally so you can follow each step.

All his intermediate code is in code blocks in an Org file so it’s easy to follow along or go back afterwards to clarify something you missed. He also has a link to the full implementation of the mode if you want to see everything together or try it out. As I said, this is a really good talk and definitely worth watching. It’s about 33 and half minutes long so plan accordingly.

Posted in General | Tagged | Leave a comment

The Pros and Cons of Emacs

Darwin Wu has an interesting post on the pros and cons of Emacs. I disagree with some of his conclusions but he does a good job of presenting a balanced view. As for the disagreements, I don’t say I’m right and he’s wrong, only that I disagree. You should read the post and make up your own mind.

His list of pros is:

  • It’s fast
  • Has a large number of packages
  • You can Navigate from the keyboard but don’t have to
  • Multiple files in a single frame

As most of you know by now, I’m all in on Emacs but I wouldn’t list “fast” as one of its strengths. The fact that Wu does makes me wonder what Atom and VS Code are like. I’ve always assumed that their architecture would make them a bit sluggish but they must be worse than I thought if they make Emacs look fast.

The other pro that I strongly disagree with is that Wu thinks it silly to have packages that allow you to do things like email in Emacs. I’m a live-in-Emacs guy and my complaint would be that I can’t do enough in Emacs. But again, different strokes for different folks.

His list of cons is:

  • High learning curve
  • The extensive customizability makes pair programming difficult
  • Documentation is scattered about and some of it is out of date
  • Too many package repositories

It’s true, of course, that mastering Emacs can take years but I’m a bit skeptical that becoming proficient with Emacs is much harder than any other editor, especially if you make use of the menus.

As for making it hard to pair program, my thoughts are best left unstated in case there are children present. I can’t imagine why anyone would care—even a little—about this.

I don’t understand his concern about documentation. There’s a lot of it, of course, but it’s all right there in Emacs. I’ve always considered documentation one of Emacs’ strengths. I’m also a bit confused about his concern that there are too many package repositories. Org-mode has its own—although it’s also available from elpa.gnu.org—but other than that there’s really only elpa.gnu and Melpa (I don’t think Marmalade is still active). As for elpa.gnu being the single source of truth, that’s laughable. I get almost all my packages from Melpa and so does everyone else I know.

I did a lot of carping in this post but Wu’s post is good and will probably be useful for those trying to decide if they want to take the plunge. As I said, read it and see what you think.

Posted in General | Tagged | Leave a comment