Emacs 26.3-RC1

I didn’t even know there were plans for an Emacs 26.3 but there are and the first release candidate is available. If you don’t want to live on the edge enough to be running the development version of Emacs 27.1, perhaps you’d enjoy the safer route of helping to test Emacs 26.3 by trying out the release candidate.

Posted in General | Tagged | Leave a comment

A Real World Use Case of Occur

Protesilaos Stavrou has posted a very nice video on using editable occur to solve a real life editing problem. The basic strategy is to use occur to locate all the occurrences of the problem to be fixed, type e in the occur buffer to make it editable, and then use a keyboard macro or other means of your choice to make your changes. The changes are, of course, reflected in the original buffer and are written to disk when you exit the edit mode of occur.

This is very reminiscent of abo-abo’s refactoring workflow that I wrote about back in 2015. The idea is basically the same: use some sort of grep-like operation to get all the relevant lines in a buffer, make the buffer editable, make your changes, and write those changes back to the file(s) they occurred in.

If you like this sort of thing, abo-abo has a video demonstrating a workflow similar to Stavrou’s. It is, I think, hard to find better examples of the awesomeness of Emacs’ editing capabilities than these videos by Stavrou and abo-abo.

As a final note, I was pleased to discover that you can make an occur buffer editable simply by pressing e. I always did it by toggling the read-only state with Ctrl+x Ctrl+q. I’m not sure why I didn’t know about using e since I use the facility all the time but then I’m always learning something new about Emacs that you’d think I would already know.

Posted in General | Tagged | Leave a comment

Apple Gets Serious About Web Tracking

In some very welcome news, Apple has announced that it will be implementing and enforcing a new anti-tracking policy in Safari. The new WebKit Tracking Prevention Policy lays out what types of tracking they will attempt to prevent and states explicitly that any attempts to bypass their anti-tracking protections will be treated just like any other exploitation of a security vulnerability. They also state that there will be no exceptions no matter how worthy the organization seeking one or how benign their intentions.

The types of tracking that they are seeking to prevent are all cross-site tracking and all covert tracking. Covert tracking is basically tracking that’s hidden from the user. It includes such things as fingerprinting and convert stateful tracking that surreptitiously stores tracking information on the user’s computer using facilities not intended for that purpose.

In their article about the announcement, The Next Web speculates that the move will force other browsers, such as Chrome, to take similar actions. I’m a little skeptical about that since the point of Chrome is to make it easier for Google to track user behavior, a point amply demonstrated by their recent decision to log you into Google under the covers when you’re logged into any Google account. Of course, some browsers, like Mozilla, have already taken similar steps and the WebKit announcement specifically gives them a shout out for being the inspiration for their own steps.

I’m under no illusion that Apple’s and Mozilla’s actions will end the scourge of adtech but I do welcome anything that makes it harder for them to spy on us.

Posted in General | Tagged | Leave a comment

The Emacs Problem Revisited

Saturday, I wrote about Slava Akhmechet’s The Nature of Lisp, which discussed why Lisp is such a powerful language. A day or two afterwards, I serendipitously came across a tweet pointing to Steve Yegge’s old post, The Emacs Problem. That’s a really great post and if you haven’t read it yet, you definitely should. I’ve written about it a number of times including here and the series of posts starting with this one on treating data as code. Those last posts are among my favorites in the Irreal canon. Among other things they demonstrate the power of Emacs viewed as a kind of Lisp Machine.

Yegge’s and Akhmechet’s posts are complementary. They both start by considering XML as the solution for a problem and show that

  1. Expressing the data structure as an S-expression makes it less verbose and much easier to read.
  2. Once expressed as an S-expression, the data can be thought of as code and made to perform useful transformations on itself.

A lot of this boils down to Lisp being really good at text manipulation or, as Yegge puts it, the only language that’s really good at it—at least for non-trivial data. Yegge’s post starts by considering the notion that Lisp is terrible for text manipulation, that Emacs proves that, and that Emacs should be rewritten in some other language such as Ruby. By the end of his post, that notion is a smoldering heap of ashes.

Akhmechet, on the other hand, doesn’t consider Emacs at all. He just lays out the case that Lisp, although hard to grasp at first, is a very powerful language and very often the right solution. Emacs is, I submit, proof of that assertion.

Posted in General | Tagged | Leave a comment

The Truth About PowerPoint

But then we already knew that.

Posted in General | Tagged | Leave a comment

Using Directory Local Variables

I’ve written before about directory local variables (1, 2) and how they can be useful for setting variables or actions with a directory-wide scope. Over at the Emacs reddit, fearbedragons has a nice tip that leverages them to slightly reduce his workflow friction.

Fearbedragons has a project in which he needs to make a lot of small compiles as he goes about his testing. To help with that he set up a small .dir-locals.el file in the project directory that automatically compiles the whole directory when any file is saved. You may or may not want to do that for your own projects but the same idea works for any action that you want to take on a file event. As fearbedragons says, “You don’t always need it, but it’s sure handy when you do.”

This post is already longer than fearbedragons’ whole tip so stop reading here and go on over to reddit to take a look at the tip. It’s also worthwhile to follow his link to the dir-locals documentation to see how things work. The syntax can be a bit confusing but, as usual, Emacs can help you out by writing the entries for you. Just call add-dir-local-variable and follow the prompts. This is a useful facility that I, at least, do not use nearly enough.

Posted in General | Tagged | Leave a comment

The Nature of Lisp

The other day I ran across a pointer to Slava Akhmechet’s post The Nature of Lisp from back in 2006. It’s an old post, obviously, but is worth reading because it does a very nice job of explaining what’s so good about Lisp and why a programmer should spend a bit of time to understand it.

Akhmechet tried several times to understand Lisp and what all the excitement was about but kept failing. The problem, he says, was the strange syntax. Of course, Lisp doesn’t really have much syntax and what it does is extremely simple. What he was really complaining about is what all newcomers to Lisp complain about: all those parentheses.

Akhmechet’s approach to explaining Lisp’s notation and concepts is to relate them to something that many programmers are already familiar with: XML. Lisp’s s-expressions are basically like XML but simpler and less verbose. Why not just use XML then? To answer that question Akhmechet considers the ANT project builder from the Java world. If you squint real hard, ANT is also Lisp-like in its architecture. You can, for example, define new operations by writing a Java class to implement it. In that way, it’s extensible.

But that approach has its limitations, the first being that you can’t extend the ANT language in XML itself and you can’t introduce new syntax constructs. Akhmechet’s post describes, in a series of steps, how Lisp overcomes these difficulties and offers a much better solution.

If you’re a Lisp weenie or if you’re wondering why anyone would want to be one, take a look at this post. It does a great job in explaining the Lisp nature.

Posted in General | Leave a comment

The Beat Goes On

The last time I wrote about the open access movement, I reported that the University of California had refused to renew its Elsevier subscriptions and that the next logical step was for individual researchers to refuse to publish in Elsevier journals. I haven’t seen news of more researchers refusing to publish in those journals but in a related move 31 UC researchers who are editorial board members of Elsevier’s Cell Press imprint, which publishes Cell and other journals devoted to cell biology, have told Elsevier that they’re withholding editorial services until the dispute is resolved.

This is significant because these are obviously people who believe in and support the journals. If they’re willing to join a boycott of Cell Press’s publications, think how much easier it would be for others in the field. Cell in particular is a top-notch journal and there’s a lot of prestige in being published by them. That will translate, I’m sure, into reluctance on the part of researchers to forego the opportunity but the growing trend among senior researchers to wash their hands of Elsevier and its journals might hasten such a boycott.

It’s probably still a little too early to tell what will happen and the situation is certainly ripe for an application of the law of unintended consequences but it feels if something is going to change. Perhaps we will, at long last, see the end of closed publishing and pay walls. Science and the world will be better off for it.

Posted in General | Tagged | Leave a comment

Six Useful Git Tips

I feel pretty safe saying that the version control wars are over and that Git has won. To be sure, there’s Subversion and a couple of other distributed version control systems whose names nobody can recall but mostly it’s Git. After Emacs converted to Git, it was pretty clear that the rear guard actions had failed and Git had prevailed.

Of course, git has a reputation for being opaque and even though systems like Magit help at lot, it’s easy for a newcomer to Git—or even a more experienced but naive user—to become confused regarding its proper usage.

James Turnbull has a useful post that contains six tips to help you become a more proficient Git user. If you’re still a little shaky on proper Git usage, it’s definitely worthwhile taking a look at his post.

I don’t want to repeat his content but I will list the six things he considers:

  1. Use of the reset command.
  2. Using cherry picking to package up the last commit for application to other branches.
  3. Amending a commit.
  4. Using stashing to temporarily save away some work in progress so that you can switch branches without having to commit.
  5. How to leverage the full power of the log command.
  6. Using the powerful bisect command to locate the commit containing code that’s causing an error.

Turnbull’s post is reasonably short and well worth a few minutes of your time.

Posted in General | Tagged , | Leave a comment

ELPA Failing to Load Packages

I always update my Emacs packages on Sunday. I’ve found that upgrading once a week is more than enough and helps limit the ever-increasing entropy here at Irreal. This past Sunday, I noticed that there was a new Org-mode in ELPA. Because Org is central to my workflow, I’d taken to using the GNU ELPA version rather than the more up to date but maybe not quite stable version from the Org repository.

When I tried to update the packages, the update aborted because it couldn’t load the new Org-mode. It said there had been a bad request. I took that to mean that the tar file was missing for some reason or another and put off upgrading until Monday. But on Monday the same thing happened. Finally, on Tuesday I saw a tweet pointing to a reddit discussion of the problem.

It turns out that there is a problem downloading from the GNU archive that’s related to TLS. Happily, the answer is simple: just add

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

to your init.el file.

Oddly, it turned out that I already had that line but it was commented out and replaced by a line that set gnutls-algorithm-priority to nil. I vaguely remember changing it to nil some months ago because of a security problem with gnutls. Presumably that’s been fixed now. I switched the commenting on the two lines, evaluated the uncommented one, and when I invoked the update function everything worked fine.

If you’re getting weird errors when you download from the GNU repository, try adding the above line to your file. It worked well for me.

Posted in General | Tagged | Leave a comment