Pinning Packages

I recently learned something useful from Timo Geusch in a post on pinning a package to a specific archive. It turns out that Emacs 24.4 has a new variable, package-pinned-packages, that tells the package system to get certain packages from a certain archive and no others. The variable is a list of cons cells of the form (PACKAGE . ARCHIVE). For example, if you want to get the package htmlize from marmalade only, you would add the cons

(htmlize . "marmalade")

to the package-pinned-packages list.

Probably the most important use of this is to specify that some packages be loaded only from melpa-stable. For example, if you want to ensure that you get the stable versions of smex, yasnippet, and typo you would add

(setq package-pinned-packages '((smex . "melpa-stable")
                                (yasnippet . "melpa-stable")
                                (typo . "melpa-stable")))

to your .emacs or init.el file.

This is really convenient and much easier than the workarounds that were necessary before.

Posted in General | Tagged | Leave a comment

Markdown Gets Code Blocks

I don’t use Markdown because, as an Emacs user, I have access to the superior Org Mode. Still, if you’re not an Emacs user, Markdown provides a subset of Org Mode’s capabilities and is definitely an excellent piece of software (although it does have some problems).

One of the most useful facilities that Org Mode provides is code blocks—what they used to call Babel—that allows you to embed executable code in an Org document, execute it, and automatically embed the results in the document. I’ve written about it many times.

Now Vittorio Zaccaria is bringing code blocks to Markdown with exemd. It’s a preprocessor for Markdown that executes embedded code blocks and inserts the results into the document. The project is still evolving and some of the planned functionality is still not implemented but what he has so far is impressive. More plugins need to be written and PDF output is still unimplemented but the project is off to an excellent start.

A real problem with exemd is that it lacks the integration that Org Mode has with its host editor. How could it be otherwise? After all, Markdown works with any editor so unless every editor builds in an interface this will continue to be a problem. Another issue is that, for the same reasons, there is not a central place to get those plugins; there’s no universal package system. Zaccaria can address the last problem by hosting or listing those modules on the Exemd site.

One further possible problem is that, as far as I can see, the only way to get exemd is through npm, which leads me to believe that it may be available only for Linux. I hope I’m wrong about that because it looks like a really useful package that users on all platforms could benefit from.

I’m really happy to see this capability added to Markdown. It’s extraordinarily useful and encourages reproducible research by making it easier. I hope this project keeps going and succeeds.

UPDATE: npm is available for all platforms so, happily, exemd should be usable by all Markdown users.

Posted in General | Tagged , | 1 Comment

EmacsGolf: Changing Times to 24-Hour Notation

Here’s a problem I dealt with recently. We have a tab-delimited data file that has time as one of the fields. The times are in the U.S. 12-hour format with a trailing ‘a’ for AM or a ‘p’ or PM. We want the times to be in 24-hour format. The file looks like

# -*- Mode: text; indent-tabs-mode: t -*-
11/13/07        7:14a   232     74      70
11/13/07        8:05a   340     85      60
11/13/07        3:47p   927     79      66
11/14/07        7:58a   109     79      72
...

and we want it to look like

# -*- Mode: text; indent-tabs-mode: t -*-
11/13/07        07:14   232     74      70
11/13/07        08:05   340     85      60
11/13/07        15:47   927     79      66
11/14/07        07:58   109     79      72
...

Note that we want each time to contain exactly 5 characters (including the colon). None of the other fields should be changed.

The file is over 1,100 lines long so editing each line by hand is not feasible. How would you do this as efficiently as possible?

Posted in General | Tagged | 6 Comments

The Legacy of Emacs

Bernd Haug has an interesting take on what the real legacy of Emacs is:

Posted in General | Tagged | Leave a comment

SBCL 1.2.6 Is Released

The new Steel Bank Common Lisp, version 1.2.6, is out and available at the usual place. As always, it built and passed the regression tests without problem.

As usual, there are a couple of enhancements and some bug fixes. All the details are on the NEWS page so go there for the details.

I really love SBCL. It’s a great Common Lisp implementation that has monthly releases, is very stable, and is very easy to compile and install. If you’re on Linux, you can download a binary. If not, it’s easy to compile—see the Getting Started page for details.

Posted in Programming | Tagged , | Leave a comment

Animated Paredit Guide

Dan Midwood has posted an excellent animated paredit guide. The post consists of animated gifs and supporting text. Midwood’s experience mirrors mine. For a long time he used only the most basic paredit features but then decided to optimize his workflow by learning a few more paredit commands.

He mentions that because paredit works by maintaining a syntactically correct source tree, it often happens that it becomes seemingly impossible to edit the text and beginners just give up and go away. This certainly happened to me but I don’t feel bad because even the formidable Magnar Sveen had problems learning paredit. Once you get over the initial hurdles, though, you won’t want to live without it.

Midwood’s post tries to take you a little further than just the basics so that you can make even better use of paredit. My only complaint is that the gifs speed by and you have to watch them several times to see what’s going on. On the other hand, the keystrokes are displayed, which makes things easier to follow. This is a really useful post and if you use paredit or think you might want to, you should definitely check it out.

Posted in Programming | Tagged | 2 Comments

Handwriting Update

It’s been a while since we’ve visited the fronts in the cursive wars. Here in the United States the trend away from cursive is moving fitfully forward with occasional counterattacks from traditionalists and their talk of Armageddon. It’s harder here because despite Common Core, the states hate being told what to do by the Federal Government and resisting on cursive is a cheap way of proving they won’t be pushed around.

Meanwhile, in Finland things are moving apace. Starting in 2016, Finnish students will no longer have to learn cursive or calligraphy but will, instead, be taught typing skills. There’s the usual pushback from the cursive partisans with predictions of declining motor skills and the like but the country as a whole seems to be on board with replacing cursive with a more relevant skill.

That’s good news from my point of view but, of course, not everyone agrees. I continue to believe that resisting the demise of cursive makes as much sense as King Canute’s trying to hold back the tide and that it is merely a matter of time until it dies a deserved death. The events in Finland are another step in that direction.

Posted in General | 1 Comment

Lisp for the Web

Adam Tornhill has a new book:

I just bought and downloaded my copy. I’ve only skimmed it so far but it looks interesting.

(via Jean-Philippe Paradis)

Posted in Programming | Tagged , | Leave a comment

eshell Examples

I’ve written before about how I’ve integrated eshell into my workflow. I’ve been using it for some time and really like it but mostly I might as well be in bash. I don’t use any of its special features and that’s a shame because those features can really speed things up.

Howard Abrams has a nice post on some of the useful aspects of eshell. I didn’t know about eshell-smart-display, for example, but now that I do, I will probably enable it. Since I don’t use zshell, I’m not familiar with the similar predicate and modifier tags that eshell uses but it’s easy to pop up a help screen—see Abrams post for details.

It’s a bit early for New Year’s Resolutions but I’m resolving, even if not for the New Year, to get better at exploiting the power of eshell. Head on over to Abrams’ post and see if it doesn’t make you want to do the same. If you like what you see, you should check out Mickey’s excellent post on eshell too.

Posted in General | Leave a comment

The loop Macro Explained by Example

Long time readers are probably aware that I don’t care for the Common Lisp loop macro. It’s not Lispy and I always have a hard time remembering its syntax. Happily, Chris Bagley, who I’ve mentioned before, has a video for that.

Bagley begins by recounting the usual arguments against the loop macro and why he uses it despite those arguments. The meat of the video, though, is a series of examples that demonstrate many of the basic loop macro constructs. After watching the video you probably won’t be a loop-master but you’ll have an idea of how things work and be able to read them in other people’s code. This is an excellent video—it’s almost enough to make me start using loop. If you’re a Lisper and not sure of how loop works, give this video 19 minutes of your time.

Posted in Programming | Tagged , | Leave a comment