Crosswords with Emacs

As I’ve mentioned before, I enjoy solving crossword puzzles. Happily, you needn’t subscribe to a newspaper to get your daily fix. There are several apps available on just about every platform that provide you with as many of the puzzles as you could wish. Although those apps are available on my Macs, I don’t have one installed because I always use my iPad or, in a pinch, my iPhone for the puzzles.

Still, that’s just me. It’s entirely reasonable that others would prefer to solve their crosswords on their lap- or desktops. If you’re one of those people and you’ve further achieved the enlightenment that everything possible should be done from within Emacs, I have good news: there’s an Emacs package for that. It’s available on Melpa so it’s easy to install if you want to try it out.

As I say, I don’t use a Mac for indulging my Crossword habit so I haven’t tried it out but it seems nice enough from the documentation. If I ever decide to move my Crossword habit to my laptop, I’ll certainly give it a try. If you’re into Crosswords and Emacs, this seems like a nice solution.

If you’ve tried it, let us know what you think.

Posted in General | Tagged | Leave a comment

Nerd Talk: Kernighan & McIlroy

Everyone with even a tenuous connection to our field knows who Ken Thompson and Dennis Ritchie are. They probably also know who Brian Kernighan is but unless they’re fully immersed in Bell Labs lore they probably don’t know about Doug McIlroy except maybe for hearing his name as “one of the gang”.

That’s too bad because as anyone who was there will tell you, McIlroy, in addition to be the manager of the Computing Techniques Research Department—the birthplace of Unix—was also one its leading lights. It was McIloy, for instance, who conceived of the idea of pipes and insisted on their implementation.

Kernighan and McIlroy have a delightful video in which they discuss some of the Unix lore including the invention of pipes. They discuss a lot of interesting technical details, including the history of many of the Unix utilities such as Diff.

To me, though, the most interesting aspect of the video was the discussion of how Bell Labs worked. Although on paper they were hierarchically organized, it didn’t actually run that way. There were no junior engineers, senior engineers, or distinguished engineers there were only members of the technical staff. As for compensation, that was entirely based on contributions not rank. Ken Thompson, for example, for paid more than McIlroy, his boss. That meant that those interested in remaining individual contributors could do so and still progress in their careers.

Because, unlike academia, there was no notion of tenure, the researchers felt free to suspend whatever they were doing to help a colleague solve some problem. This synergy was responsible for a lot of the Lab’s discoveries.

If you have any interest in Unix lore this video is definitely worth your time. It’s just over 52 and a half minutes so plan accordingly.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: Emacs Discoverability

Here’s nice coda to yesterday’s post on Mickey’s essay on bad Emacs advice.

As with all great humor, this is hilarious precisely because of the truth it’s based on.

Posted in General | Tagged , , | Leave a comment

Bad Emacs Advice

The incomparable Mickey has a few words to say on Bad Emacs Advice. Mickey and I have been using Emacs for approximately the same amount of time and although we are both still learning, we agree that there’s some well meaning but bad advice about learning Emacs. Mickey identifies the four hot sports for bad advice:

  1. Turn off the menu and tool bars
  2. Ignore the Emacs manual
  3. Don’t bother with the tutorial
  4. Don’t use the Custom Interface

In a nice example of serendipity, I learned a couple of new things from Mickey’s post on Emacs advice. The first is that you can access the menu system from the keyboard with Meta+`. that’s probably not useful for any but the most hardcore antimouse GUI user but it’s very useful if you’re using Emacs in terminal mode.

The second revelation is that can find out what a menu item does in exactly the same you find out what a key combination does: Simply precede the menu mouse click with Ctrl+h k.

Mickey’s advice strikes me as sound. Whether or not you use the menu bar when you gain a bit of experience, it’s undoubtedly true that it can be a big help in learning Emacs. Some say the same about the tool bar but I’ve never found it useful: it’s ugly, doesn’t help you learn the shortcuts, and doesn’t have any functionality that the menu bar doesn’t. As for the manual and tutorial, advice to ignore them seems particularly ill advised to me. Why wouldn’t you want to avail yourself of comprehensive documentation on the workings of Emacs?

As for the Customize Interface, I used it a lot in my early Emacs days but don’t use it at all now except for those automatic package things that Emacs insists on inserting into the Custom Configuration and even then I exile it to custom.el so it doesn’t pollute my init.el.

I agree with Mickey about his take on bad Emacs advice. Take a look at his post to see what you think.

Posted in General | Tagged | Leave a comment

Finding the Directory of the File in a Buffer

The other day I saw this Tweet

and it reminded me of problem I had the other day: I needed to find the directory containing a file in a buffer. I was pretty sure that there was a way of doing that but I couldn’t remember what it was. There’s buffer-file-name but it’s not interactive and I couldn’t, in any event, find it in the heat of the moment.

When I saw the Tweet, I thought that was a pretty nice way of doing it but the result is less than pleasing on a Mac because it yanks focus away from Emacs and opens a finder window. After a minute’s thought I realized that a better way is to use M-! pwd. That lists the directory part of the path in the echo area so it’s just what I needed.

Posted in General | Leave a comment

Open Access at Nature

As Irreal old-timers know, I am interested in and a supporter of open access. The academic publishing industry is deeply exploitive of everyone they deal with. That includes members of the public who provide financial support for much of the research they publish but are nevertheless expected to pay hefty fees to see the results.

One of the changes that I and others have predicted was that the business model of the publishers would change to provide open access for all in exchange for a publishing fee paid by the researchers or their institutions. That seemed like a good solution but only because of my naivete. Here’s how Nature implemented that plan. The publishers will always try to game the system, whatever it is.

The TL;DR is nicely captured in this hilarious video mocking the plan. If you read the whole thread, you’ll note that Dr. Glaucomflecken says that everything in the video is accurate except for the 12 year old doing their formatting.

The video is devastating precisely because it is so true. If you weren’t already against the publishers this should do the trick. Perhaps whatever rises from the ashes of the rapidly self-immolating higher education industry will structure their tenure and promotion policies to make this sort of exploitation impossible.

Posted in General | Tagged | Leave a comment

Combining Find and Grep in Emacs

One of the classic Unix idioms is to search all files in a file hierarchy for some regular expression with a find/grep pipeline. For example, to search the lisp directory and all of its subdirectories for file containing the mapcar function, one could use

find ~/lisp -name "*.lisp" -exec grep -H mapcar {} \;

That pipeline finds every .lisp file in the hierarchy and runs grep on it looking for mapcar.

I, at least, don’t do this type of thing very much anymore because there are so many easier ways of doing so, especially from within Emacs.

Nonetheless, it’s still possible to usefully combine find and grep from within Emacs to build a Dired buffer of all the files that contain the matching regex. This tweet by
Mickey tells you how:

There’s a bit more to the command so you should take a look at the on-line documentation if you have a use for it.

Posted in General | Tagged | Leave a comment

Adding To a Keyboard Macro

Wilfred Hughes’ Emacs Command of the Day Twitter feed has a useful tip:

I’ve seen this before and may even have written about it before but I always forget about it. I’m not sure why; it could hardly be simpler: just prefix the start macro command with the universal argument.

In any event, it’s a useful reminder for me and may be for you too.

Posted in General | Tagged | Leave a comment

MELPA Surpasses a Quarter Billion Downloads

From Steve Purcell:

I’ve said this before but it bears repeating: We all owe Purcell our thanks and, if we happen to meet him, a beer. He has, virtually single-handedly, run the most important Emacs package repository. It’s a lot of work that Purcell donates to the our community and more often than not his only feedback is complaints when the rare glitch isn’t resolved quickly enough.

A quarter of a billion downloads is a lot for a community the size of ours and underscores again the tremendous amount of work required to keep things ticking along. There are currently 5,077 packages in MELPA and each one has been curated and validated by Purcell or one of his helpers.

So again, let’s all raise to toast to Purcell and if you happen to be where he is, buy him a round.

Posted in General | Tagged | Leave a comment

Red Meat Friday: SICP in JavaScript

Remember a couple of weeks ago when I declared No. Just no? Well, here’s another, even more emphatic, refusal to accept the apocalypse.

No. Just HELL no!

The thing about SICP is how simple and beautiful the code is and how precisely it demonstrates the concepts under discussion. To pretend that you could do the same with JavaScript is self delusion of the first order.

Yeah yeah, I know. There’s more code written in JavaScript than there are atoms in the universe. There are also more Ford Focuses than Rolls Royces. That doesn’t make Focus the better car or JavaScript the better language. More to the point, JavaScript is a bad fit for SICP.

I have long abhorred MIT’s decision to replace SICP with Lego robots or something but this latest outrage is an act of vandalism. If you want to learn the wisdom in SICP then learn Scheme. The whiners notwithstanding, it’s an easy language to learn. Indeed, 6.001, the MIT course in which SICP was used, didn’t have any time devoted to teaching Scheme. Students just picked it up as they went along.

If we’re going to abandon SICP as a teaching vehicle, we should at least let it rest in peace and not desecrate its corpse.

Posted in General | Tagged | Leave a comment