Emacs Rocks! Episode 13

Magnar Sveen is on a tear and has posted another Emacs Rocks! episode. This one is, to use a phrase Sveen might utter, mind-blowing. It’s a demonstration of his Emacs extension multiple-cursors. When I first saw this extension demonstrated in Sveen’s Oslo Web Rebels talk (that I discussed here) I was blown away by the seeming magic of it. Episode 13 gives a much more comprehensive demonstration and simply must be seen to be appreciated.

The really good news is that multiple-cursors is now available on Marmalade and Melpa. I’ve been using mark-multiple (also by Sveen) but disabled it after I downloaded multiple-cursors because the latter is essentially a superset of the former. Watch the demonstration and you’ll want to install it too.

I’ve just started using it but I’m already Addicted. As I say, watch the video and you’ll be an addict too. And if you haven’t already, watch the Web Rebels talk too—it’s fantastic.

Posted in General | Tagged | Leave a comment

An Elisp Puzzle

Xah Lee points to this interesting tweet The three S’s of SUCCESS by Gary Fredericks and asks for something similar in Elisp. Fredericks’ code is

(map (vec "SUCCESS") [0 5 6])

which certainly isn’t Elisp.

My first attempt at Elisp is

(mapcar (apply-partially #'aref "SUCCESS") '(0 5 6))

which does the trick but outputs the results as integers

(83 83 83)

because that’s how Emacs represents characters.

If we want to print out the actual S’s we need to wrap the above in some extra code

(mapcar #'char-to-string (mapcar (apply-partially #'aref "SUCCESS") '(0 5 6)))

which yields

("S" "S" "S")

What we really need here is something like the Common Lisp char function that outputs the actual characters but, of course, Emacs can only do this my making strings. On the other hand, CL lacks the nice currying function apply-partially so I don’t see a nice succinct solution in it either.

Update Noam has a much better solution in the comments.

Posted in Programming | Tagged , | 4 Comments

Common Lisp Type Hierarchy

Greg Pfeil over at Techomatic has a nice chart of the Common Lisp Type Hierarchy. Technically, there’s no new information here, of course, but it is nice to have all the information in any easy to read diagram.

If you’re a Lisper, this diagram is worth a look. It makes the whole hierarchy visible in a simple and clear way.

Posted in Programming | Tagged | Leave a comment

Emacs Rocks Episode 12

Magnar Sveen has Episode 12 of Emacs Rocks up. This time it’s about editing HTML. As usual, Sveen demonstrates some nifty tricks to make editing easier. Some of them use standard Emacs functionality and others extensions that he has written.

My only complaint is that the video moves very fast and it’s sometimes hard to see what he’s doing without replaying it several times. That problem is mitigated to some extent by a listing on the episode page of all the commands that he’s using. The pacing problem notwithstanding, this episode, like the others, is outstanding. You may also want to pick up some of Sveen’s extensions. They are very useful; I already can’t live without some of them.

Posted in General | Tagged | 1 Comment

The Vim Horror

Via Xah Lee: The horror! The horror!

Posted in General | Tagged , | Leave a comment

What the…

If you’re a Lisper here’s a surprising bit of Common Lisp arcana from Xach’s Common Lisp Tips. Did I mention that you really should subscribe?

Posted in Programming | Tagged | Leave a comment

The Acme Editor

Russ Cox has posted a video tour of the Acme editor. If I weren’t using (and extraordinarily happy with) Emacs, this is the editor I would be using. For a long time it was only available with Plan 9 but Cox missed it so much when he stopped working on Plan 9 that he ported it and much of the Plan 9 environment to Unix like systems (such as FreeBSD, Linux, and OS X). That port is available to all as Plan 9 from User Space.

The video is entertaining and well worth a look. Perhaps it will give you some ideas that you will want to port to Emacs.

Posted in General | Tagged | 3 Comments

Have You Tured Today?

Of course you have. Wait. What is turing? For reasons explained on his Web site, Don Knuth defines to ture as to use the Internet. Knuth asks that if you agree with this definition that you encourage its use via social networks.

I’m not sure if this will catch on but it does fulfill a need and is not offensive so I’d be just as happy if it did. If you agree, you should pass on the suggestion in whatever way you have.

Posted in General | Leave a comment

Internal Irreal Links with Emacs

I try to keep a couple of posts in reserve for those days when nothing strikes me as worth writing about. Other times, I may write a series of posts on a related topic and not post them until the entire series is done. Whenever possible, I like to provide internal links to previous posts to provide readers with context. For example, in a series the subsequent posts might have links to the previous posts in the series.

The problem is that those earlier posts haven’t been published yet so there’s nothing to link to. Fortunately, org2blog inserts the page ID of the post into the org file when it get’s pushed to WordPress so I can push the posts to WordPress as drafts and then publish them later. That means that the org file has the page ID of the post so that I can link to it even though it hasn’t been published yet. Of course, the post containing the link has to be published after the linked post.

As I’ve mentioned before, org links have the form

[[url][label]]

so knowing the url, which for Irreal posts is http://irreal.org/blog/?p=ID where ID is the page ID, makes it possible to add links to not yet published posts.

Naturally, I’m much to lazy too do that by hand so I whipped up a bit of Elisp to do it for me:

(defun irreal-post (label id)
  "Make a link to an Irreal post given its ID number and a label."
  (interactive "sLabel: \nsID: ")
  (insert (concat "[[http://irreal.org/blog/?p=" id "][" label "]]")))

Now I just call irreal-post, fill in the label and post ID and the link is inserted. As with most of these little helper functions, it’s not a big thing but it does make my life a little easier.

Posted in Programming | Tagged , | 1 Comment

Some Good News From PHP

Here’s some encouraging news on the security front. As regular readers know, I’ve written several times about how to safely hash passwords and complained about sites that don’t do it correctly. Now PHP 5.5 has a function that does the right thing automatically. Just make the call

$hash = password_hash($password, PASSWORD_DEFAULT);

and you get a properly salted password hash processed by bcrypt. The default algorithm of bcrypt can be overridden as can the amount of work required to hash the password.

PHP programmers no longer have an excuse for not doing the right thing. No special knowledge or crypto expertise is needed. Simply use the provided API and get safe password storage. Let’s hope a facility such as this comes to other programming environments.

Posted in Programming | Tagged | Leave a comment