Zamansky: Learning Elisp #5

Mike Zamansky is back with the fifth episode of his Learning Elisp Video series. I say “episode” rather than “video” because he’s split Learning Elisp #5 into two videos. That was to prevent a single, overly long video. As it is, the two videos run 14 minutes, 4 seconds and 12 minutes, 55 seconds.

The theme of the first video is conditional statements: if statements and the like. As Zamansky points out, the Elisp if statement is pretty much like the if statements of other languages but with a bit less syntactic sugar. You can, of course, chain these if statements as you do in other languages but Elisp has a better way: the cond statement that lets you test sequential conditions and perform the action associated with the first condition that returns t.

He uses the cond statement to expand his rot13 function to deal with capital letters and characters that aren’t a letter. At this point, he’s got a reasonable rot13 function.

The second video has two main themes. The first is how to make his rot13 function accessible from the Emacs “command line” (via Meta+x) and assign it to a key sequence short cut. This mainly involves the (interactive) declaration.

The second theme is applying rot13 to arbitrary text in the current buffer without actually typing the text in. He begins with showing how to apply it to the word at point and the entire line at point. No doubt he’ll expand on this in subsequent videos to provide a flexible rot13 like the built-in version.

At this point, his Learning Elisp series is beginning to show how to use Elisp to build useful functions for actual use in Emacs. If you’re new to Elisp, this is a very useful series to follow.

This entry was posted in General and tagged . Bookmark the permalink.