50 points · by gordonguthrie · 15y ago · 27 comments
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...
CGI: http://stackoverflow.com/questions/1532311/cgi-programming-i...
AWK Example: http://stackoverflow.com/questions/2260294/awk-print-2-1-in-...
Extract URLs: http://stackoverflow.com/questions/1642184/extracting-urls-f...
Parse CSV/Gen HTML: http://stackoverflow.com/questions/1541682/lisp-script-to-pa...
Wrap Selection like Textmate: http://stackoverflow.com/questions/1558178/wrap-selection-in...
MySql (Unanswered): http://stackoverflow.com/questions/1532365/mysql-queries-fro...
Generate a Quiz: http://stackoverflow.com/questions/2264286/generating-a-quiz...
Open Browser: http://stackoverflow.com/questions/1532365/mysql-queries-fro...
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...
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...
Saying "no decent beginner's book" sounds a bit snippy and up myself so I have edited the Gist.
http://www.gnu.org/software/emacs/elisp/html_node/Coding-Con...
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.
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.
I know as much eLisp as is covered in the book so far - so I have no idea of the difference between lexical and dynamic scope in eLisp.
Doing a quick scan of the site-lisp on my 'proper' dev machine (ie not the Virtual Box image I am writing the book on) I find that the following (uncompiled) files require cl:
* mh-acros.el
* rst.el
* js2.el
* css-mode.el
* html-helper-mode.el
So it is clear that the convention "don't use cl" is being honoured in the breach for fairly standard bits of code - so as an idea it needs to be considered.
Of course, if you signed up for the mailing list as a Lisp expert, we could nag you about questions like this :) http://groups.google.com/group/learn-elisp-for-emacs
If all you have ever programmed in is Fortran, Algol, Pascal, C++, Java, PHP, Python, Perl, Ruby and Erlang then Lisp looks like line noise/obsfucated Perl (delete as appropriate).
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.