Mike Zamansky has the third video in his Learning Elisp series up. As promised, this one is about writing functions. As Zamansky points out, Elisp functions are pretty much the same as function in other languages except for the lack of a return statement and, of course, the syntax.
There are a couple of interesting aspects to Elisp functions. The first is the Doc String. Lots of languages have something similar but in Emacs the Doc String is automatically imported into the Help system so a user’s own functions are documented just like the built-in functions.
The second aspect is the interactive
declaration. Including it makes the function “interactive”, which means that you can call it from the keyboard with Meta+x or by assigning it a key binding. My goal for writing Elisp is to write an interactive function where I remember to add the interactive
declaration before I try to run it from the command line.
The video covers just the very basics of writing functions. Zamansky is planning on getting into some of the deeper aspect in later videos. This video is 12 minutes, 36 seconds long so you’ll probably have to schedule some time.