Using Lisp

Anurag Mendhekar has an interesting post about why he uses Lisp and thinks you should too. He uses several different Lisps—Scheme, Common Lisp, and Racket—but boils down their essence to, “An s-expression based, dynamically typed, mostly functional, call-by-value λ-calculus-based language.”

Most of his post is an explication of each of those characteristics, including their advantages and disadvantages. Mendhekar takes a pragmatic view on each of them. While he believes they are generally the right thing, he understands that sometimes you want to violate them. He illustrates this most clearly, I think, in his discussion of statically typed versus dynamically typed languages.

Mendhekar is an advocate of dynamically typed languages and contra conventional wisdom makes a good case for them. That basically boils down to static typing seldom really helping make better programs but always getting in the way by enforcing rules that are so general that they often don’t make sense. The power of Lisp is that although it’s generally dynamically typed, you can make it statically typed when you need to. Take a look at Mendhekar’s post for a more nuanced explanation.

He also discusses how s-expressions eliminate many of the syntax related annoyances of “conventional” languages. There is no associativity or precedence rules to worry about. Everything is either a list or an atom: that’s all there is.

As many of you know, I spent most of my career hacking C but once I discovered Lisp, I didn’t want to program in anything else. If you’d like to explore Lisp, I think Scheme is the best place to start. Some folks recommend Clojure but Mendhekar avoids it for reasons he explains in his post. In any event, take a look at Mendhekar’s post for a good discussion of why you should be using Lisp.

Posted in General | Tagged | Leave a comment

Covid Origin Phase Two Study Cancelled

WHO has announced that the planned second phase of their study to determine the origin of COVID-19 has been canceled. Exactly no one is surprised by this. The reason given for the cancellation is China’s refusal to provide access to their researchers and records although there are certainly factions in the U.S. with no appetite for exploring the question.

As I’ve said many times before, when I have my scientist’s hat on it’s currently impossible to come to a definitive answer regarding the genesis of COVID-19. If, on the other hand, I put my informed man-on-the-street hat, there’s a lot of cogent evidence pointing to a lab leak from the Wuhan Institute of Virology resulting from the gain of function research that was reportedly being performed there.

The cancellation of the phase 2 study is a further datum providing yet another reason for suspicion. A reasonable person could ask, “What are you afraid of having revealed?” As Paul Graham pointed out, the cancellation itself tells us a lot about the origin of COVID-19:

Again, none of this is definitive but it’s getting harder and harder for a thoughtful person to escape the conclusion that COVID-19 did indeed result from an accident in a laboratory performing gain-of-function research.

Posted in General | Tagged | Leave a comment

The History of Emacs

Over at Linux User Space, Leo and Dan have a short video giving a reasonably comprehensive history of Emacs:

They start with TECO and the infamous tower of Babel that grew out of every developer having their own set of macros leading Guy Steele and Richard Stallman to develop a standard set of Editing MACroS that everyone could use. From there, they trace Emacs’ development from a set of TECO macros to the current day GNU Emacs. Along the way, they discuss Gosling Emacs and its relation to GNU Emacs as well as the Lucid version that eventually became XEmacs.

The video is 14 and a half minutes long so it shouldn’t be too hard to fit in. If you’re freaked out by the warning about leaking your IP address in the Twitter link, just follow the above link and watch it on YouTube.

Posted in General | Tagged | Leave a comment

Org Mode For Project Breakdown and Estimation

Over at In a stream of Random Thoughts .. there’s an interesting post on using Emacs and Org mode for breaking down and estimating projects. The idea is that each new project is given an Org file that breaks down tasks to be performed, progress made on those tasks, and estimates for completing them.

This Org file is populated with Yasnippet to ensure uniformity and placed in a file hierarchy that reflects the state of the project. There are directories for active projects, pending projects, paused projects, and completed projects.

The breakdown in each project file serves as a basis for making estimates. Nothing can make time estimates easy, of course, but having a project broken down into its constituent parts does make it less of a burden.

Take a look at the post to see if some of its ideas could be useful in your own workflow. My takeaway is the advantage of using Yasnippet to initialize each project file to ensure that nothing is missed. By having to “fill in the blanks” you help avoid missing any important details.

Posted in General | Tagged , | Leave a comment

Is VS Code The Spiritual Successor To Emacs?

Vivek Haldar is a Python fan and considers Guido von Rossum “one of the best language designers of our time.” He was surprised, therefore, when von Rossum suggested in a Lex Fridman podcast that VS Code was the spiritual successor to Emacs. For many of us, that’s like lighting a stick of dynamite under our chair but Haldar considers the idea of VS Code being the spiritual successor to Emacs calmly and rationally.

Not surprisingly he disagrees. Von Rossum bases his assertion on the fact that VS Code and Emacs are both structured as an interpretive language engine at the core and the majority of the editor implemented in that language. In Emacs’ case, that language is Lisp. In VS Code’s case it’s JavaScript. Theoretically, that makes them both highly extensible but there’s a difference.

Haldar says that Emacs has two things that VS Code doesn’t:

Barrier-less extension
The idea that you can write some Elisp anywhere in Emacs, mark it, execute it with Meta+x eval-region, and have the effects take place immediately. If you like the changes you can add the code to your init.el and have its action take place every time you start Emacs.
Everything is a buffer
I’ve written about this before. As Haldar says, it basically means that whatever you do in Emacs, it’s in a buffer and subject to the usual Emacs editing and manipulation functionality.

I’d add a third Emacs advantage: Emacs is Free Software and not owned by anyone. I say that not as a true believing ideologue but as someone who’s been around long enough to know how Microsoft operates and to not trust them or their intentions. I worry that Microsoft will eventually revert to type and pull the rug out from under VS Code users.

In any event, Haldar reaches the same conclusion that I do: VS Code is not the spiritual successor the Emacs.

Posted in General | Tagged | Leave a comment

Xcape on macOS (Sort Of)

Yesterday I wrote about T V Raman’s post explaining how he uses the X Windows xcape command to provide extra keys and better ergonomics for Emacs. Raman has some nice ideas about improving the Emacs keyboard interface but they were, unfortunately, restricted to those using X Windows. That’s a lot of people, of course, but about a quarter of those who use Emacs are doing so on a Mac and Raman’s hack wasn’t available to them.

Jeremy Friesen to the rescue. Like me, he was intrigued by Raman’s post but unlike me he decided to do something about it. He had a head start because he’s a Karabiner-Elements user and Karabiner makes it easy to do the sort of thing described by Raman.

Take a look at Friesen’s post for the details. Not everyone will want to do this but if you think your workflow could benefit from overloading modifier keys to provide additional shortcuts and eliminate some chording, it’s nice to know it’s possible for Mac as well as X Windows users.

Posted in General | Tagged | Leave a comment

Better Ergonomics Under X

T V Raman has a post that may be interesting to those of you who run Emacs under X. That’s probably just about everybody who isn’t using a Mac so many of you may be interested. The TL;DR is that his method turns the modifier keys into what he calls buttons. For example, (with his setup) pressing (just) the Ctrl key will send Ctrl+e to Emacs.

His keyboard has three modifier keys on each side of Space and adding the two Shift keys gives him eight possible “buttons”.

The key to making this work is the xcape command in the Xorg keyboard configuration to define what each of the buttons produce. Raman links to his xcape and XModmap configurations so you can see how he set things up but you’ll probably prefer other mappings.

The advantage of Raman’s method is two fold:

  1. It avoids chording for commonly use commands.
  2. It gives you several (8 in Raman’s case) extra keys to do something useful with.

If you’re an X user and interested in improving your keyboard ergonomics or perhaps just gaining some useful shortcut keys, take a look at Raman’s post. If you’re not afraid of modifying your XModmap file it’s not hard to set up.

UPDATE [2023-02-17 Fri]: Added link to Raman’s post.

Posted in General | Tagged | Leave a comment

Tempo Templates

Nicolas Martyanoff has a post on something I didn’t know about: Emacs Tempo templates. I’ve been an Emacs user for somewhere between 15 and 20 years and I’d never heard of Tempp templates. On the one hand that’s pretty surprising. On the other hand, we all know that learning Emacs is a lifelong journey that is never completed.

As most of you know, I’m a Yasnippet user and find it very useful even for non-programming chores so I’m not in the market for another templating engine but if you’re new to templating, Tempo may be worth a look. I don’t have any experience with it, obviously, but based on Martyanoff’s description I’d judge that Yasnippet is easier to use and learn and seems more flexible too.

Martyanoff says that one of the virtues of Tempo is that it’s simple but I find it harder to use than Yasnippet so my advice to the template n00b is to use Yasnippet. Still, as always, Emacs let you have your way. Along with skeletons there are three1 template systems you can use with Emacs so there are plenty of choices.

Footnotes:

1

Unless there’s yet another Emacs templating system I don’t know about.

Posted in General | Tagged | Leave a comment

Emacs Comes to Android

Here’s some good news: The F-Droid site now has a more or less complete implementation of GNU Emacs for the Android platform. I’m not sure Emacs on a phone is all that useful other than for dealing with Org files and there are several apps already available for that on both the Android and iOS platforms. On a tablet, though, it could be a real game changer. Emacs on a tablet—perhaps with a real keyboard—would enable truly remote work. Yes, you can carry your laptop around as many of us do but a tablet is much easier especially in situations such as air travel.

We here at Irreal are famously iPhone/iPad users so F-Droid’s announcement doesn’t affect us directly but perhaps it will encourage Apple to relax their no interpreters rule on the platform. I understand their reasoning but having a workable Emacs on the iPad would be such a win that it would be worth it, especially with appropriate sandboxing.

If we had Emacs on the iPad it would change my mobile computing strategy completely. I’d get a good keyboard for the iPad and probably almost always leave my laptop at home. The iPad, modulo software, is already as powerful as many laptops and could easily support remote work. I have a family member—in banking not software—who already uses his iPad as his exclusive mobile device. There’s no reason we developers couldn’t do the same. All we need is Emacs. I love my laptop and don’t foresee myself ever giving it up but it sure would be nice to have an easy-to-carry device for remote work.

Posted in General | Tagged | Leave a comment

Clocking and Status Changes

Just a quickie today courtesy of Mario Jason Braganza. Like most developers, Braganza is lazy in that good way that makes us search out ways to automate mundane tasks. Sometimes the automation doesn’t save much—or even any—time; it’s the principal of the thing. That and the prevention of the mental exhaustion resulting from the need to perform boring, repetitive tasks.

In Braganza’s case, that boring task is clocking in and out of tasks with a status of IN_PROGRESS. This isn’t an optimization that’s going to save any appreciable amount of time but it does collapse two tasks into the one task that it logically is. Check out his post for the exact problem that he’s trying to solve.

Although the solution is simple, he spent a day researching the problem to find it. That’s certainly more time than he’ll save in a lifetime of using the fix but it does address the all important issue of programmer mental fatigue. That and the satisfaction he gets from optimizing his workflow, even if in a small way.

Posted in General | Tagged , | Leave a comment