Live data from Hacker News

Learn Emacs Lisp in 15 minutes

bzg.fr

31–40 of 71 posts

Re: Learn Emacs Lisp in 15 minutes

#31
post #24

Earlier quoted context omitted.

It actually works similar enough that I switch between Vim and Evil daily without getting annoyed. I usually use Vim from the terminal. The follow things you asked about are all working: Macros Repeat :' s/foo/bar/gi :%s/foo\(bar\)/bar\1/ It is very actively developed and quite stable. There are of cause Vim features that are not implemented yet, but the core seams to be very well covered.

Interesting, maybe I'll give it a try. Do you feel any kind of impedance mismatch from using emacs w/o the native emacs bindings?

No, Emacs should be configured to your liking. The default Emacs keybindings (especially the more complex ones for common things) suck.

That said, you're still using Vim keybindings within Emacs and for some operations that Vim has no equivalent for you will need some Emacs knowledge. Also, some thing that Vim does have an equivalent for are easier to do in Emacs.

You cannot step into Emacs + evil-mode thinking you will never need to know anything else. You would be well advised to learn some Emacs basics and then help functionality.

For day-to-day operations like buffer editing you'll be able to use you Vim muscle memory.

Re: Learn Emacs Lisp in 15 minutes

#32
If 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.

Re: Learn Emacs Lisp in 15 minutes

#33
post #5

Basic 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-:),…

This is why I'm eagerly watching Light Table releases waiting for the "good enough" moment. It's going to have the advantages you mentioned, except in Clojure(script), which is, er, more broadly applicable. The GUI being bog-standard Webkit is another major plus. Emacs has had an astonishing run but is just slightly too opinionated for me to have taken the plunge. The promise of light table has kept me working in sub…

LightTable is proprietary software. Please use Emacs instead.

Re: Learn Emacs Lisp in 15 minutes

#34

If 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 _eve…

I 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?

Re: Learn Emacs Lisp in 15 minutes

#35
post #22

Earlier quoted context omitted.

After 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 ten…

>A: Foot pedals. That's hilarious. I get that emacs has technical merit but the keybindings are horrendous. Even if they don't cause hand pain they're long-winded and distracting.

> [B]ut the keybindings are horrendous. Even if they don't cause hand pain they're long-winded and distracting.

Ha, after 26 years using Emacs I find Vim's keybindings long-winded and distracting. To each their own. However, unlike many people I don't dismiss vi because of unfamiliarity, or use them as an excuse not to learn the editor. I try to use it all the time, but I can never seem to train myself to do non-trivial things with it.

I have the similar problem with other editors: I've seen people rave about Sublime Text, yet none of its killer features (modulo multiple selections) really strike me as worth switching. And any of its features I think I want I could (conceivably) implement in Emacs, so...

Re: Learn Emacs Lisp in 15 minutes

#36

Earlier quoted context omitted.

This is why I'm eagerly watching Light Table releases waiting for the "good enough" moment. It's going to have the advantages you mentioned, except in Clojure(script), which is, er, more broadly applicable. The GUI being bog-standard Webkit is another major plus. Emacs has had an astonishing run but is just slightly too opinionated for me to have taken the plunge. The promise of light table has kept me working in sub…

LightTable is proprietary software. Please use Emacs instead.

The facts are more complex.

"I'm a firm believer in open source software and open source technologies. I can guarantee you that Light Table will be built on top of the technologies that are freely available to us today. As such, I believe it only fair that the core of Light Table be open sourced once it is launched, while some of the plugins may remained closed source. At some level, this is an experiment in how open source and business can mix - it will be educational for us all."

http://www.chris-granger.com/2012/04/15/light-tables-numbers...

I take this promise in good faith, unless I see reason to believe it will be broken.

Re: Learn Emacs Lisp in 15 minutes

#37
post #5

Basic 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-:),…

On top of paredit, try redshank http://www.foldr.org/~michaelw/emacs/redshank/ (process s-exp to refactor etc) This is taken from John Wiegley's talk at emacs conf, here's a little summary of his emacs environment btw : https://gist.github.com/jwiegley/5277578

I was interested to see that Wiegley's config file is notated in org-mode, using the Literate Programming extensions that come built into Org. That's why the file looks more like documentation than code.

For Emacs to actually evaluate the file, it must first be tangled to an .el file, but tangling the file is a trivial step. I write my own Elisp the same way, as .org files. Thanks for the link and Redshank too.

Re: Learn Emacs Lisp in 15 minutes

#38

Emacs 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.

Indeed. 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.

Re: Learn Emacs Lisp in 15 minutes

#39
post #4

That 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.

I'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 integ…

Allow 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.

Re: Learn Emacs Lisp in 15 minutes

#40
post #35
post #22

Earlier quoted context omitted.

>A: Foot pedals. That's hilarious. I get that emacs has technical merit but the keybindings are horrendous. Even if they don't cause hand pain they're long-winded and distracting.

> [B]ut the keybindings are horrendous. Even if they don't cause hand pain they're long-winded and distracting. Ha, after 26 years using Emacs I find Vim's keybindings long-winded and distracting. To each their own. However, unlike many people I don't dismiss vi because of unfamiliarity, or use them as an excuse not to learn the editor. I try to use it all the time, but I can never seem to train myself to do non-triv…

With regards to multiple selections, have you seen: http://emacsrocks.com/e08.html http://emacsrocks.com/e13.html
Post reply on HN