Difference between revisions of "Emacs Lisp Ressources"

From WikEmacs
Jump to navigation Jump to search
(should read about functionnal programming)
(Read a good book !)
Line 45: Line 45:
  
 
You can read it inside Emacs with C-h i m Emacs Lisp Intro RET (all in one go).
 
You can read it inside Emacs with C-h i m Emacs Lisp Intro RET (all in one go).
 +
 +
==== Read a good book: Writing GNU Emacs extensions ====
 +
 +
Many blog posts won't replace a good book. If you're into writing elisp functions, you must read [http://shop.oreilly.com/product/9781565922617.do "Writing GNU Emacs extensions"] written by Bob Glickstein (O'Reilly). It covers many more things than we've seen up till now, in a tutorial style: it begins gently and then takes the reader by the hand to the process of writing an extension and introduces a lot of concepts and good practices.
 +
You should buy it (you'll easily find a pirate copy on the net though).
  
 
==== Wikemacs ====
 
==== Wikemacs ====

Revision as of 10:19, 2 June 2014

This page presents links to noticeable Emacs lisp tutorials out there. They are somewhat sorted by difficulty.

Bastien Guerry's beginners tutorial

I think you should read Bastien Guerry's Emacs_Lisp_in_15_minutes. It is targeted at newbies. In the end you know how to write functions, move around and search regexps.

Did I say Bastien was the mainainer of org-mode for many years ?

Xah Lee's code snippets

Xah Lee has a number of very useful lisp tutorials that show many practical aspects of the language, with a down-to-earth attitude. They are concise and ready to use.

In elisp-basics he covers the basics of the language: printing, arithmetics, true and false, global and local variables, tests, iterations, blocks of expressions, data structures, the concept of symbol.

But we wouldn't know what to do with the basics of the language without the basics of Emacs functions: how do we build useful functions ? In "common elisp functions" he covers:

  • getting the cursor position
  • moving the cursor and searching,
  • text editing,
  • grabbing text,
  • strings,
  • preserving point and mark,
  • buffers and files basics.


An introduction to Emacs Lips by cjohansen

This tutorial is written by a beginner and may not be beautiful or concise elisp (it received a couple of contributions from readers though), but it is then super suited for a beginner who wants to extend emacs. Cjohansen wants to write elisp code to help him do an editing task. He uses the classical approach of searching text around and applying changes. Thus he shows how to:

  • define variables
  • move and restore point
  • looking around without moving the point (save-recursion)
  • check that the current line contains what we want
  • find the closing bracket
  • write interactive functions (to call with M-x)
  • define local variables (the let construct)

and in the end we have well constructed code and I think all the concepts of lisp were introduced (conditions, loops, predicates, etc).


Learn functionnal programming

So you looked at some elisp but you don't feel very comfortable with the map construct, that is, with functionnal programming. I think it's time you have a look at it before going deeper into elisp. Reading a specific tutorial did much help me to get the elisp's way of doing. You have the choice: (E)Lisp, Haskell, Ocaml etc are functional languages. I myself liked very much the online tutorial of Haskell: http://tryhaskell.org/ . It quickly introduces you to the basic concepts shared by those languages. If you want, you can jump to lesson 14 to experiment with functions (map, filter, etc).

Official tutorials

The official tutorial is located here: https://www.gnu.org/software/emacs/manual/html_node/eintr/

You can read it inside Emacs with C-h i m Emacs Lisp Intro RET (all in one go).

Read a good book: Writing GNU Emacs extensions

Many blog posts won't replace a good book. If you're into writing elisp functions, you must read "Writing GNU Emacs extensions" written by Bob Glickstein (O'Reilly). It covers many more things than we've seen up till now, in a tutorial style: it begins gently and then takes the reader by the hand to the process of writing an extension and introduces a lot of concepts and good practices. You should buy it (you'll easily find a pirate copy on the net though).

Wikemacs

Don't forget to check wikemacs' pages on Elisp !