8 ms·
Learn Emacs Lisp in 15 minutes
- lelf 13y agounless you get so angry that you throw it on the floor Hey, just M-x doctor
- mickeyp 13y agoI would encourage would-be Elisp hackers to read the info manual "An Introduction to Programming in Emacs Lisp" that is bundled with your Emacs (`C-h i` then select "Emacs Lisp Intro" from the Table of Contents) as it enables you to evaluate the example lisp forms in-line in addition to being a really great and pedagogical introduction to elisp.
- eksith 13y agoThat was actually quite helpful. I've had the toughest time "thinking in Lisp" as I'm told I have to do to get my head around it (also because I work with the C++/C#/PHP family and switching between them and Lisp doesn't help). I really appreciate the simple instructions in that regard.
- TomDavey 13y agoI'm not a professional programmer, but I spend all day in Emacs primarily because of org-mode. Two years ago I read about org-mode here on HN and was inspired to give Emacs a shot. Today Emacs is my main technical hobby. Extending Emacs with Elisp is a pleasure and a joy. My various init files total over 3,000 lines of code that I wrote my own little self. That said, while I remain incredibly impressed with the integrated documentation system, especially the Info manuals for their sheer literacy and clarity, I discovered over time that it doesn't adequately teach you "the Lisp way." Explanations of the basic concepts -- like a symbol for crying out loud -- are scattered and not really complete, leading to frustration as I got deeper into extending Emacs. For me, the light bulb went off after I worked through Seibel's Practical Common Lisp. I've also read chunks of PG's On Lisp. Together these two outstanding books resulted in an epiphany regarding Lisp and the functional approach in general. The result is that, where before I couldn't figure out Emacs's own Elisp sources (i.e., "Why is this function written this way, and not that way? Why do I see this idiom so often, what's it doing?"), now I can. The payoff for writing my own Elisp has been incalculable. Now I'm fired up to read SICP, and Felleisen et al, hoping to learn more about functional programming.
- agumonkey 13y agoAllow me to suggest Coursera. They have nice courses about FP. Somehow in simple -> difficult order. Systematic Program Design by Gregor Kicsalez (I believe influenced by HtDP). Programming Languages by Dan Grossman. (50 50 HtDP SICP and Brown University material)* Functional Programming using Scala by Martin Odersky (influenced by SICP). In case you can already do the SICP exercises without issues then you won't need these, but otherwise, the deadlines and automatic grader were great ways to keep a regular pace in learning. *) this course focuses on semantics, and language design, the problems are not hard applied problem solving, that's why I put it in 2nd, but they can twist your mind quite a bit when dealing with different meta-levels.
- TomDavey 13y agoI've never heard of these. Thanks much.
- gruseom 13y agoCongratulations for figuring all this out and getting to enjoy the rewards. But I'm curious: what do you do all day in Emacs if not programming?
- jasonm23 13y agoHere's a short list of possible things... - Email - File Management - Text processing - IRC - Newsreading - Server Admin - Web browsing (esp. documentation) - Basically anything you can do in a terminal, and more (it'll display/process images, PDF, SVG) For most of these hardcore users, it's simply more convenient to stay in a highly programmable environment than it is to go and use an "end user" tool.
- tikhonj 13y agoBasic Emacs lisp is well worth learning. It takes Emacs from being an editor to being your editor. With something like Eclipse, even adding a little bit of functionality is an undertaking. You have to create a project, write a bunch of boilerplate, load it and so on. With Emacs, it's basically effortless: a line or two of elisp can do wonders. Sometimes I add functionality by just executing elisp directly (with M-:), without even bothering to put it in a file! It's that easy. This has really changed how I work. Now I don't think twice about having some throw-away elisp for just one project. Or even just one file! Modifying the editor (in small ways) becomes an action almost as natural as copy and paste. Now Emacs is like a jazz performance, with room for improvisation: never the same editor twice. Emacs is also the perfect development environment for Emacs lisp. (Who would have guessed?) It's the most integrated system I've ever seen; there is an intuitive and remarkably consistent link between the lisp code and the editor itself. I usually know how some bit of elisp corresponds to an action and vice-versa. And if I don't, the incredible interactive help system is, well, helpful: I can easily look up what function a keybinding calls or what keys are bound to a function. These days, I do it instinctively, without thinking. Throw in Emacs's general lisp prowess (paredit is incredible), the ability to randomly evaluate an expression and see the results immediately as well as the ease of inspecting variables and you have a very remarkable environment. 15 minutes as the key to all this? There's no question! Since you're going to be using your editor for years, it's well worth 15 hours or 15 days or even 15 weeks. (And since it's Emacs, you'll end up using it for more than just programming: LaTeX, org-mode, blogging, chatting, email...) Go for it!
- recuter 13y agoAn excuse to dive into lisp like that just might pull me away from Vim (Vimscript is terrible, sigh).
- terhechte 13y agoHave a Look at Evil, really good vim bindings for emacs
- krisajenkins 13y ago
- king_magic 13y agoHa, this is perfectly timed. After years of being a vi/vim user (not for any particular reason, it's just what I learned a few years back and just stuck with), I decided to start running through the Emacs tutorial for the hell of it yesterday. I really miss Lisp from my college days, and being able to work it back into my regular workflow just sounded like a fun idea. I read through this tutorial and its really a great introduction, really well written and very clear. Nice job!
- hannibal5 13y agovi is the god of editors. emacs is the editor of gods.
- s_baby 13y agoemacs is the editor of sore wrists.
- hannibal5 13y agoQ: How do you recognize experienced Emacs user? A: Foot pedals. http://bc.tech.coop/blog/041024.html http://bc.tech.coop/blog/041024.html http://www.cb1.com/~john/computing/emacs/handsfree/pedals.html http://www.cb1.com/~john/computing/emacs/handsfree/pedals.ht...
- chrismonsanto 13y agoAfter a decade of Emacs, I never had wrist problems, but I did end up developing pinky problems, due to remapping Ctrl to Caps Lock. I tried foot pedals (and still have them under my desk). They were better than nothing, but after I switched to the Kinesis Advantage keyboard I ended up not using them anymore. Hitting Ctrl+Alt with your thumbs is more convenient than hitting them with your feet, especially since I tend to fidget a lot. Another advantage (no pun intended) is that the arrow keys are convenient to hit, which lets you remap several standard Emacs keybindings. For example, I use C-b to switch buffers. Neither switching keyboards nor using foot pedals solved my hand pain, however. I ended up having to take more drastic measures: I switched to the carpalx QGMLWB keyboard layout[1]. One of the advantages of the carpalx approach is the clear and powerful mathematical model which quantifies the effectiveness of keyboard layouts. I was able to select a layout that minimizes pinky strain--if I had switched to Dvorak or Colemak, I would have increased my pinky strain. [1]: http://mkweb.bcgsc.ca/carpalx/?full_optimization http://mkweb.bcgsc.ca/carpalx/?full_optimization
- dschiptsov 13y agoEmacs is a miracle, no doubts. It is self-descriptive and self-contained system, like Smalltalk (you could lookup any function, variable or even key-binding, without a fancy browser, but in a way that is good enough). There is nothing much to say, actually. Emacs is just a wonderful thing.
- patrickmay 13y agoIndeed. The most value I got from from learning to customize Emacs wasn't the functionality I implemented but seeing how powerful a domain specific language can be. The ways that Emacs Lisp supports working with text, whether data or code or documents, showed me what I should be aspiring to when I create a DSL.
- dschiptsov 13y agoImagine, then, what a wonderful thing Open Genera was.)
- DennisP 13y agoApparently an older version was opensourced at some point. I don't see why the people who love it don't port it to x86.
- dschiptsov 13y agoAnother not quite obvious thing about emacs is the result of ./configure --prefix=/usr/local --program-prefix=t \ --without-all --with-x-toolkit=no && make -s bootstrap Which will give you, say, your beloved Clojure's Nrepl on a remote machine over ssh. Yes, it works perfectly fine in a terminal.
- adambard 13y agoThis will definitely be merged into learnxinyminutes.com when I'm back from vacation :-)
- benhsu 13y agoIf you don't like lisp-interaction-mode, you can also use ielm (M-x ielm) as an elisp repl
- marincounty 13y ago1. Every book on computers, or anything technical should read this guys blog before they get fire up the word processor. 2. My biggest gripe about 99.9% of COmputer programming books are: They are long. They are poorly written. They read like a telephone books. 3. I once heard one famous programmer state, I won't read a programming book with more than 500 pages. I think he was off by 400 pages? 4. I truly believe if you take 80% of words out of most books; it would make learning a subject easier.
- Ziomislaw 13y agowriters get paid per word, still wondering why 80% of book has no substance?
- gcr 13y agoPeter Van der Linden included a recipe for Oobleck¹ on the last few pages of "Expert C Programming: Deep C Secrets". It's right after the Phony C++ Job Interview Answer Key and right before the paragraph-long rant about Dr Seuss's influence on the software engineering profession. [1] http://en.wikipedia.org/wiki/Non-newtonian_fluid#Oobleck http://en.wikipedia.org/wiki/Non-newtonian_fluid#Oobleck
- Willyfrog 13y agoI have a similar one, I don't buy a book with more than 200 pages, as I'm unlikely to read it.
- artagnon 13y agoIf you don't know Emacs Lisp, there's no point of using Emacs. You'd probably be more productive in Vim or [insert favorite proprietary editor here]. Emacs Lisp is probably the most featureless language you can think of; it doesn't even do basic threading and the async stuff is a joke. All the major programming language modes are implemented as ad-hoc Elisp regexp parsers making bugs impossible to fix. Virtually _everything_ is implemented in Elisp, because the C code is a gigantic unmaintainable mess. This means that all the pretty high-level stuff like Magit is shit slow. Good features take ages to propagate to upstream, whose reasons are often more political than technical. However, it is the only programmable editor in the world, and people continue to churn out more and more Elisp. Recent developments like MELPA and Marmalade have made packaging and distributing easier than ever, and users just need to `M-x package-install` to get their favorite packages set up. The reason Emacs has been so successful is very simple: there is one global environment where all symbols are bound; any package can overshadow any existing symbol (variable/function) from anywhere. There are no "core" functions versus "library" functions; any package can modify very "core" behavior (for instance, find-file) very easily [1]. Ofcourse, this has severe downsides: you can eval bad code and screw up your Emacs environment pretty badly (it might even refuse to quit); often the only way to recover is to restart Emacs, flushing the environment. I'd say: learn as much as you can about editors from this monster; enjoy tinkering with it. Hopefully, a fresh community will come together to build another programmable editor soon. [1]: The exception is the few C builtins.
- treerex 13y agoI always get a chuckle out of people complaining that Emacs is too slow. Maybe I've just "gotten used to it", but when I first started using it I was sharing a Sun 3 with ten or fifteen other people. I'd also argue that modes in other editors are ad hoc regexp parsers in some other form... regexps, in the hands of someone who knows what they're doing, work well. And yes, virtually everything is implemented in Emacs Lisp. That's the whole point. People have been trying to build "another programmable editor" for 30 decades. It hasn't happened yet. Why do you think it will happen soon?
- DennisP 13y ago
- chiachun 13y agoI felt that the "Teach Yourself Programming in Ten Years" was also very helpful.