You Are Not Expected to Understand This

I recently came across a post that explains the famous comment in the 6th Edition Unix source code: * You are not expected to understand this. I haven’t seen or thought about this for years but it was once quite famous and appeared on all sorts of geek paraphernalia. The post describes the comment as notorious but it really wasn’t as flippant as it seems. The code it was describing is very hairy because it makes use of an artifact of a particular compiler for a particular machine. As Dennis Ritchie explained (see blow) this broke when they ported Unix to the Interdata and the code was rewritten.

Rob Pike tweeted that a few years later they understood the problem better and could use simpler code

Dennis Ritchie shows the code and explains (scroll down a bit) what it was doing, what they really meant by the comment, and admits that the real problem (as suggested by Pike’s tweet) was that they didn’t understand the problem very well either. Nowadays context switching is well understood and not considered the least bit hard so it’s interesting to read that real programming gurus like Ritchie and Steve Johnson struggled with getting it right.

If you have the Lions book, you can see the code in its original context (you can get the book here or from Amazon). By the Seventh Edition of Unix the code had been rewritten and the comment was gone.

UPDATE [2017-01-17 Tue 12:04]: There’s a great thread on all of this from the The Unix Heritage Society mailing list.

Posted in General | Tagged | Leave a comment

Recurring Org Events

Karl Voit has published an instructive post on how to specify recurring events in Org mode. As most of you know, you can annotate an Org TODO entry to specify that it should occur every day, every week, every 3rd day and other more complex criteria.

Even if you’re familiar with the above, Voit has an alternative method that I wasn’t aware of. That method is org-clone-subtree-with-timeshift that will duplicate the current entry but apply different time stamps. This has some benefits over the more common method. In the first place, if you have a meeting on Tuesday for the next 5 weeks, you can make the first TODO entry and then call org-clone-subtree-with-timeshift with a repeat of 4 and a timeshift of 1w. That gives you the exact number of entries and can edit or delete one or more as necessary. Another benefit is that you can add notes to each entry separately rather than having everything together in a single entry.

Take a look at Voit’s post for the details and more advantages of this method. It’s also a nice summary of how you can specify dates and times whether or not they’re recurring.

Posted in General | Tagged , | Leave a comment

A Reminder about Emacs Keybindings on MacOS

Recently, I’ve seen tweets such as this one:

It’s been a few years since I last wrote about that so here, as a public service, is a link to my post that explains how to install Emacs keybindings to MacOS apps. The process is simple so if you’re a heavy Emacs user on a Mac be sure to check it out. I use this and would be lost without it.

Posted in General | Tagged | 1 Comment

An Org Workflow

Gregory J Stein, an MIT Ph.D student in Electrical Engineering and Computer Science, has an interesting post on how he uses Org mode and the agenda to organize his projects and daily tasks. Like all graduate students, he leads a busy life so seeing how he leverages Org mode in his workflow is interesting and instructive.

Like me, Stein uses his agenda as a journal of what he’s done on a given day as well as keeping track of tasks that need to be done. Part of that is a fairly rigorous use of clocking to track his time. While that’s mostly a matter of developing the right habit patterns, he also has Org set up to automate it as much as possible.

One interesting strategy is his use of the MEETING keyword for his agenda. That keyword is used for scheduling meetings, of course, but he also uses it if some drops by his desk while he’s working. He has a capture template for meeting that automatically stops the clock on his current task and resumes it when the “meeting” is over. That’s a nice way of handling interruptions to your timed tasks. You could, of course, just stop the clock manually but if you’re like me you’ll almost never remember to do that so Stein’s method is a win.

There’s some other useful ideas in the post so you should be sure to give it a read. He also has a link to his configuration so you can see the details of how he set up his environment.

Posted in General | Tagged , | Leave a comment

The Iron Law Strikes in Baltimore

Baltimore has an aerial surveillance program that uses a small plane equipped with high resolution cameras flying over the city for hours at a time.

When the program was announced there were many privacy concerns but the public was assured that

  1. The data would be used only for major crimes.
  2. The data would be destroyed after 45 days unless it was being used in an active investigation.

If you’re familiar with the Iron Law of Data Collection, you know how this story ends.

The data was not destroyed after 45 days and was subsequently used to charge individuals with crimes without informing the court or defense council where the evidence came from. Worse, the company running the program, Persistent Surveillance Systems, admits that they have archived all the data—not destroying any of it—and is now considering selling the data to third parties. Follow the link to see some of the consequences of that.

At the risk of being tedious, it’s worth repeating the lesson that this and similar stories are trying to teach us: Never believe anything the snoopers tell you and resist their pleas for “just one more small program that is, of course, for your own good.”

Posted in General | Tagged | Leave a comment

A PSA from Sacha

Here’s a useful public service announcement from Sacha Chua:

Posted in General | Tagged , | Leave a comment

Mobile Org on iOS

If you live in the Apple world and are an Org mode user, here a bit of good news. The iOS MobileOrg maintainer has announced that he and others are resurrecting the iOS Mobile Org app.

I keep seeing queries on Twitter and elsewhere asking about Org on iPhones and lamenting that MobileOrg appeared to be dead. Those folks can join me in rejoicing that there’s some movement in the project. If you’re interested in what MobileOrg can do, here’s a link to the MobileOrg Github page.

Posted in General | Tagged , | 2 Comments

Capturing Gcal for Display in Emacs

Ben Maughan has a post that represents another way of integrating Gcal into Emacs. In my first two posts on this, we looked at how Rainer König and Mike Zamansky imported their Google Calendars into their Org agendas. Maughan has a slightly different use case. He uses his Org agenda to track tasks and his calendar for appointments and he doesn’t want the appointments in his agenda.

Still, like many hardcore Emacs users, he’d like to do as much as possible in Emacs so he wanted a way to read his Google calendar from Emacs without importing it into the agenda. He found a nice way of doing this with gcalcli, a utility that allows you to access a Google calendar from the command line. With just a little bit of glue code and some extra processing to take care of colors, he can import his calendar into an Emacs buffer.

If you’re a “live in Emacs” person who also uses Gcal, this is a nice way of staying in Emacs even as you check your calendar. The system provides a view of the calendar only; you can’t interact with it as you can with Zamansky’s method. See Maughan’s post for the details.

Posted in General | Tagged | 2 Comments

Elisp Text Processing Idioms

The hard part of learning Elisp is not the syntax. Being Lisp, the syntax is trivial and takes about 10 minutes to learn. The real problem is learning the library and, perhaps even more difficult, the proper idioms for getting things done. For example, a n00b writing Elisp code may load a file by calling find-file, the command used at the user level to load a file with Ctrl+x Ctrl+f but that is almost never the best strategy.

One excellent way of learning Elisp is Xah Lee’s Emacs tutorial. In particular his page on Emacs Lisp Idioms for Text Processing really helped me get up to speed with writing Elisp. I’m certain I’ve linked to that page before but it bears repeating: if you’re trying to learn a bit of Elisp—even if all you want to do is add an occasional function to your configuration—you should definitely read this page and the pages linked to it.

The definitive authority, of course, is the Emacs Lisp Reference Manual, which is also available as an info file right from Emacs, but for getting an idea of how to actually write Elisp, Lee’s tutorial is hard to beat. Read his tutorial and read some of the Emacs (or Emacs packages) source and you’ll be well on your way to becoming a competent Elisp programmer.

Posted in General | Tagged | 1 Comment

By the Way

On Tuesday, I wrote about my discovery of org-next-link and how it quickly became my go to method of navigating to Org links. Today, my target link was before the point and it suddenly dawned on me that there was probably an org-previous-link and that it would be mapped to Ctrl+c Ctrl+x Ctrl+p. That turned out to be true, of course, so I’m passing it on in case there are one or two other folks out there to whom this is not immediately obvious.

Again, if you often have the need to navigate to Org links it’s worth internalizing the shortcuts. It’s amazing how much faster it’s made my moving around in Org documents.

Posted in General | Tagged , | Leave a comment