
New Years Resolution: Learn (e)Lisp? - gordonguthrie
https://gist.github.com/754568
======
melling
On StackOverFlow, before I quit, I was building up a suite of elisp questions.
I though this format provided an excellent way to learn and throw down some
breadcrumbs.

Note on Unix/Mac, you can use Emacs as your scripting language:
#!/usr/bin/emacs --script

This should be a good start:

Hello World: [http://stackoverflow.com/questions/2170528/writing-hello-
wor...](http://stackoverflow.com/questions/2170528/writing-hello-world-in-
emacs)

CGI: [http://stackoverflow.com/questions/1532311/cgi-
programming-i...](http://stackoverflow.com/questions/1532311/cgi-programming-
in-elisp)

AWK Example: [http://stackoverflow.com/questions/2260294/awk-
print-2-1-in-...](http://stackoverflow.com/questions/2260294/awk-print-2-1-in-
emacs-lisp)

Extract URLs: [http://stackoverflow.com/questions/1642184/extracting-
urls-f...](http://stackoverflow.com/questions/1642184/extracting-urls-from-an-
emacs-buffer)

Parse CSV/Gen HTML: [http://stackoverflow.com/questions/1541682/lisp-script-
to-pa...](http://stackoverflow.com/questions/1541682/lisp-script-to-parse-csv-
and-generate-html-table)

Wrap Selection like Textmate:
[http://stackoverflow.com/questions/1558178/wrap-selection-
in...](http://stackoverflow.com/questions/1558178/wrap-selection-in-open-
close-tag-like-textmate)

MySql (Unanswered): [http://stackoverflow.com/questions/1532365/mysql-queries-
fro...](http://stackoverflow.com/questions/1532365/mysql-queries-from-elisp)

Generate a Quiz: [http://stackoverflow.com/questions/2264286/generating-a-
quiz...](http://stackoverflow.com/questions/2264286/generating-a-quiz-in-
emacs-lisp)

Open Browser: [http://stackoverflow.com/questions/1532365/mysql-queries-
fro...](http://stackoverflow.com/questions/1532365/mysql-queries-from-elisp)

Finally, I thought having the same questions answered in Common Lisp would be
useful.

Generate a Quiz: [http://stackoverflow.com/questions/2264267/generating-a-
quiz...](http://stackoverflow.com/questions/2264267/generating-a-quiz-in-
common-lisp)

~~~
gordonguthrie
Yeah, I was thinking of asking a community wiki on Stackoverflow about what
should be in the table of contents.

------
defroost
You wrote: "I wanted to learn eLisp but there are no decent beginners' book"

Actually there is a fantastic Emacs Lisp book by Robert J. Chassell called "An
Introduction to Programming Emacs Lisp"

[http://www.gnu.org/software/emacs/emacs-lisp-intro/emacs-
lis...](http://www.gnu.org/software/emacs/emacs-lisp-intro/emacs-lisp-
intro.pdf)

~~~
gordonguthrie
IMO a beginners book should be more basic than "An Introduction To Programming
Emacs Lisp".

Saying "no decent beginner's book" sounds a bit snippy and up myself so I have
edited the Gist.

------
mahmud
If you MUST learn elisp, at least use its Common Lisp package; it adds
features and makes some sane changes to elisp that make it into a modern Lisp:

<http://dto.github.com/notebook/require-cl.html>

~~~
gordonguthrie
There are some difficulties with that - certainly for beginners.

[http://www.gnu.org/software/emacs/elisp/html_node/Coding-
Con...](http://www.gnu.org/software/emacs/elisp/html_node/Coding-
Conventions.html)

What I am trying to do is make it possible to get people to start writing
'code that works' up to the point that they want to stop learning and start
writing their own code.

If you know how a language/build setup works in general, then you can work out
why in your particular case something isn't working.

If you literally can't read a languages syntax (and for most programmers Lisp
is as unreadable as the Cyrillic script is to someone used to the Latin
script) then 'do this and it will work' is key to a smooth learning process.

Once people have got over that, then they can take the training wheels off the
bike themselves.

~~~
mahmud
All they would need to do is add this to the beginning for every file
"(require 'cl)".

The CL package is already bundled with Emacs, and a good chunk of emacs
packages and libraries are written in it. It's not Common Lisp, just some
syntatic sugar to make Elisp more like CL and every other mainstream language
out there. IMO, your readers will have more difficulty understanding dynamic-
scope than remembering to add a line. CL provides lexical scoping with
lexical-let.

~~~
bitdiddle
for sure the issue of dynamic scope is important. I often wonder how even more
successful emacs would have become had Guile worked out.

~~~
eeperson
There is an intention to make lexical scoping the default in Emacs. Maybe even
as soon as the next version (Emacs 24).

------
cannedprimates
What's wrong with the Giraffe Book? <http://oreilly.com/catalog/9781565922617>

~~~
gordonguthrie
I only found out about it after I had started writing this one. I have never
seen a physical copy of it.

I also think the fairly brutal way that the Learn X The Hard Way format forces
you through typing in working code is a good way for people to learn how to
'read' a new/weird syntax <\-- not meant derogatively, just strangely
unfamiliar.

------
bitdiddle
Great resolution, but I'm surprised by this. Type C-h i in most emacsen and
you should see a great elisp tutorial as well as the full elisp manual. All
you need is the space bar to read it.

~~~
gordonguthrie
I have never been able to navigate the help in Emacs - I am sure it tells you
how to do it in the help - but I have never got that far.

~~~
bitdiddle
Oh, just type C-h t and a very simple tutorial will get you going.

~~~
KC8ZKF
C-h t gives you the Emacs tutorial. i.e. how to use the editor.

'C-h i m Emacs Lisp Intro <RET>' will bring you the elisp introduction.

------
hsmyers
1\. Make it easier for people to comment on your text--- some sort of wiki
perhaps? 2\. Beginners forget, so telling them that you won't repeat
information (key strokes to evaluate an expression) isn't going to help. 3\.
In the line 'The way in which you evaluate the expression determines where the
output goes. Alos notice that the previous examples used integers like 1 and 2
and returned an integer value. This expression uses floating point numbers
like 1.0 and returns a float as the result. ' Alos should be Also... 4\. If
you can get to a feature in the editor with key-strokes list them. If you can
get there using the menu say so. If you can get there both ways mention that.

~~~
gordonguthrie
I would like to make it like PHP documentation where you can add comments
directly to the HTML pages - but that means mastering the Sphinx Document
Building system as well.

------
samuel1604
funny to see this, it is actually my new year resolution

