Leaving Deft for Vanilla Emacs

The title almost doesn’t make sense. After all, if you’re using Deft, you’re ipso facto using Emacs. James Dyer explains it in a way that makes sense. The TL;DR is that although he has been using Deft, he’s decided to use Org mode instead. He lists several reasons for this, which you can see in his post. The thrust of his post is that there’s nothing wrong with Deft but Org mode and the other built-in Emacs capabilities are a better fit for his workflow.

The reason I’m writing about this is Dyer’s last sentence:

“I think this is an example of over time learning that emacs has a lot of what you want already built in and with org mode it gently nudges you to organise files in a more coherent manner leading to a more simple agnostic digital way of life.”

That is, I think, a great point. Emacs has a multitude of packages that provide a huge amount of useful functionality but many times, everything you need is already there.The great thing is, when you need more, there’s almost certainly a package to give it to you. As always, Emacs has your back.

UPDATE [2023-02-26 Sun]: Added link to Dyer’s post.

Posted in General | Tagged , | Leave a comment

Webdriver

One of the most useful capabilities I have on my computer is the ability to capture the URL of the current page in my browser. That doesn’t sound too exciting but I use it many times a day when I’m writing blogs posts or annotating code, or doing anything else where I want to reference a Web page.

This is particularly easy on macOS as I’ve previously recounted. Since then, I’ve tried to find ways of doing this in other OS environments. None of them are as easy as macOS but I’ve recently come across something that may solve the problem once and for all. That something is emacs-webdriver.

It’s a way of controlling your browser from Emacs which is what Applescript allows you to do on macOS. If you’re an Emacs user and often want to incorporate a URL from your browser this is a real boon. You can, of course, switch context to the browser, capture the current URL in the title bar, and switch back to Emacs but it’s a lot easier to simply invoke an Emacs command with a key shortcut.

Webdriver is a general API that’s not restricted to Emacs and can do much more than simply capture the current URL or title of the current Web page. Even if you don’t need all its capabilities, just being able to grab a URL from your browser is a useful capability. Again, I use this capability everyday in macOS and it’s something you may want to enable it on your own systems.

Posted in General | Tagged | Leave a comment

EKG

No, not electrocardiogram, Emacs Knowledge Graph. It’s a small project by Andrew Hyatt that is best thought of as light weight Zettelkasten sort of like the popular Emacs applications Org-roam and Denote.

Take a look at the GitHub README for an explanation of the project. There’s also a shorter description of the application on reddit but the best explanation is this video on ekg that demonstrates the app and discusses the design. The video is just short of 46 minutes so you’ll need to schedule some time.

One way of thinking about the project is that it’s Hyatt’s attempt to overcome the limitations imposed by Org’s “everything is text” principal. A practical consequence of this is that explicit forward and back links get replaced by tags. This makes linking notes essentially automatic: if two links share a tag, then they’re linked and discoverable from each other. To make this idea more useful, tags can be multiple words. Everything, even the note text, is stored in an sqlite database so searching is fast and effortless.

The project is still fairly new—although it is in Melpa—and Hyatt is still struggling with some of the concepts but he’s been using it at work for several months and hasn’t found any problems. All of this is explained in the video and if you have any interest at all in the package, you should spend the time to watch it.

This looks like an interesting project and it’s one I can see myself adopting. It seems like an excellent way to keep a set of notes: it’s easy to add notes and to find them later.

Posted in General | Tagged | Leave a comment

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