Ask HN: Should I learn (E)Lisp before switching to Emacs?

8 points by rooam-dev ↗ HN
Hello,

I mean switch for good, to get most out of it down the road. I know there are tutorials and guides out there, but after trying a few more advanced I see some "weird syntax" which my understanding is the Lisp part of it. So, perhaps "getting" Lisp 1st would make the transition worth it more.

Thank you in advance.

11 comments

[ 2.9 ms ] story [ 37.1 ms ] thread
I don't think you need a whole lot of elisp knowledge to get started. You'll probably pick up a fair bit from writing your own config file, which isn't too hard. Then you can learn as needed from there. I use emacs for org-mode and still barely know elisp although I'm an experienced lisp programmer.
I've been using Emacs since 2013. The only critical use I have had for eLisp is in my .emacs (configuration) file. That has always been for 'one liners' based on something I've looked up on the web. Often it's copy and paste with a little tweaking.

My only extensive use of eLisp was a three/four week project I did in eLisp in order to learn it. Sometimes I will use ielm (interactive eLisp mode) REPL but usually I am running an another language's interpreter under Emacs and that's the language at the front of my brain.

While eLisp is a great tool, most of the existing tooling is much more mature and stable than anything I might write. And there are good tutorials on the things I am most likely to write such as a mode for some obscure language (but a language has to be pretty obscure not to already have a mode in Emacs). Good luck.

Yes, that is what i wanted to be able to make sense of those one liners to avoid frustration of not having any idea why it's not working. Thanks.
About all the Lisp you need to know for that is Python/Javascript/C code that looks like:

  myFunc(3, "odd", myOtherFunc(7, 4, 8));
In a Lisp might look like:

  (myFunc 3 'odd (myOtherFunc 7 4 8))
Essentially the parentheses move, the commas go away, and strings that are used for dispatch are passed as symbols ('odd in Lisp instead of "odd"). On the one hand, that's really about it.

On the other hand...there's a lot more to learning Lisp than that. It's just like any other programming language...it takes a non-trivial number of months.

But you can use Emacs without knowing any Lisp at all. And the basic syntax of (func arg1 arg2 ... argN) gets you a long way. If you get the basic idea of quoting, you can probably parse all the code in just about any .emacs file.

The hard part of Lisp is understanding all the implications and possibilities of quoting and applying them to abstract away complexity in a problem domain...your .emacs file won't need to do that because the relevant complexities are already abstracted away by the Emacs system as shipped.

Thanks for your feedback. I found this short intro that helps to get an idea at least.

https://learnxinyminutes.com/docs/elisp/

If you're going to learn a Lisp, eLisp is a very good entry point. In part because it's just another Lisp and learning one gets you pretty far with other. More importantly, Emacs provides a context for building tools by applying the language. There's less need to search for meaningful projects and no need to search for libraries that do what you want. Everything for working with Emacs is baked into the environment.
I'd encourage you to try the built-in tutorials on the subject, starting with "An Introduction to Programming in Emacs Lisp" (unless you still have to complete the general emacs tutorial, in which case, press C-h t). Imho, being able to effectively navigate the builtin documentation tools (C-h i, C-h k, C-h m, C-h f, ...) is what allows you to ramp up your emacs knowledge the fastest.
Giving the manual a skim and following the built-in Emacs tutorial (C-h t) are probably good ideas, but not much beyond that - you don't need to learn elisp before starting to use Emacs.

You'll probably learn it well enough after you'll start tweaking your configuration file, and the best environment to do that is actually Emacs itself: the scratch buffer will start out in lisp-interaction mode, which means that you can execute elisp snippets with C-j, and being into Emacs also means that the documentation of the various functions and variables is just a C-h f/C-h v away.

Just learn a little bit is enough for you to start using and configuring Emacs.

However, when you want to do more advance configuration (e.g. write your own feature), you will need to learn more about Emacs lisp and Emacs’s API.