I’m a long-time Emacs user who is new to the under-the-hood side of things. I recently started learning EmacsLisp and writing my own Emacs extensions. I like sitting in IRC channels devoted to technical subjects I’m interested in, so I found #emacs and started hanging out there. It was not long before I discovered the Terrible Secrets of the Emacs community: EmacsLisp Sucks and Emacs Is Dying.
This caused me a great deal of consternation and confusion, because I love Emacs and had recently become quite fond of EmacsLisp, so much so that I was toying with learning LISP as a standalone language. I tried to get more information, but “What do you mean, ‘EmacsLisp sucks’?” was more often than not met with a reply which seemed either elliptical, tautological, or a non sequiteur, at least to someone with my level of understanding of the issues (none).
In it, he idenitifies problems with Elisp:
This, from my highly unscientific sample, is far and away the most popular reason EmacsLisp sucks. Well, that’s good to know. EmacsLisp is also not Perl, or COBOL, or IBM 1130 assembler, or a bicycle, or an orange. Thanks for the help!
I didn’t know Scheme – and in fact do not now claim to know Scheme, though I have begun working through SICP – and to my untrained eye, the main difference between EmacsLisp and Scheme was that Scheme required hitting the shift key a lot more (#t, #f, set!, predicate?, etc). Further inquiry eventually yielded the conclusion that this reason is really just a restatement of “EmacsLisp doesn’t have lexical scoping”.
That conclusion is not justified. There’s a great deal of difference between Scheme and EmacsLisp beyond just the question of lexical scoping. As the OP mentions in passing, but then ignores, there’s the fact that nil isn’t false in Scheme, but is in CommonLisp and EmacsLisp. Scheme has a stylistic convention of marking destructive operations with an exclamation point and predicates (boolean functions) with a question mark; again noted in the OP. I’m not sure the latter is so significant, but the former indicates a stigmatization of side-effecting in the Scheme community, more closely wedded to function programming concepts, that we certainly don’t see in EmacsLisp. Scheme is a Lisp-1, sharing the same namespace for variable and function definitions, so that the name list must be bound (at least locally) either to a function, or a variable, but not both. In a Lisp-2, you can use the same name for both a function and a variable.
This is a perfectly valid criticism of a programming language. I can see immediately how automatic lexical scoping of variables is a big win when writing complex and/or large Emacs extensions.
However, as a new EmacsLisp programmer writing simple Emacs extensions which deal more with buffers and words than with turning Emacs into, say, a realtime financial analysis suite with embedded web browser, I really like the fact that I have access to every state variable in the whole editor. I can see if anything is set, and what it’s set to. It’s really quite great, being able to instantly harness the whole power of Emacs to frob my text around in an automated fashion. Is it possible to get lexical scoping without losing this?
Allegedly optional lexical scoping is coming after Emacs 23 is released. (according to emacs-devel) Once it’s in place, adding coroutines will be feasible, which addresses the “single-threading sucks” argument that’s surprisingly absent on this page. Should also make closures possible.
I don’t know enough about any of these to offer any informed commentary, except to note that aside from Common Lisp, they all seems to be edge cases that either no one supports seriously, or only one or two people in the universe actually want.
I heard this a lot as well, but I have no idea what exactly is being referred to. Elucidation greatly appreciated.
I don’t know. Which do you, the EmacsLisp detractor, mean?
Most people seem to hate EmacsLisp-the-language, but the primary obstacle to replacing EmacsLisp is, of course, EmacsLisp-the-library. 30+ years and 80+ megabytes of Emacs functionality, all in EmacsLisp. Redoing even the core editing functions is a terrifying thought to me.
This is the larger question I referred to in the Scheme section. I can’t say for sure, but my gut feeling is that most of the people who are unhappy with EmacsLisp are the people who are using Emacs as an application development platform rather than as an extensible editor.
I am, of course, aware of the kitchen-sink nature of Emacs, and revel in it. I know that the design of Emacs evolved in the time when a programmer only had access to a single terminal session to a computer, thus becoming in effect the world’s first Integrated Development Environment so a user could meet all their needs without dropping in and out of their primary application: the editor.
But I believe there is a difference between making Emacs read mail or news or have a shell because you needed to in the 1970s and making Emacs browse web sites or act as an httpd because you can in the 2000s. I wonder if perhaps the people who want to fix all of EmacsLisp’s problems want to do so more for their own benefit – so it will be a better general-purpose development base and toolkit – than to make Emacs better for everyone. I wonder if they have lost sight of the primary application: the editor.
This is meant to be polemic but not dogmatic. I have stated my observations, opinions, and conclusions, but I have done this to show my point of view and lack of full understanding rather than to try and convince others that I am correct. I am not against fixing or replacing EmacsLisp, but I have yet to see any logical, thorough, and cogent arguments for it. Therefore: get to arguing!
 The last sentence of this paragraph is especially telling. The author has:
 Scheme is a standard lisp dialect, easier to implement than CL, partly because it’s smaller, partly because the standard was written with optimization in mind. In contrast, CL was written with commonality in mind. Important differences include a focus on tail recursion and CPS optimization. I think Scheme used to not have keyword arguments, but I’m no longer sure about that one.
 A tremendous number of emacs extensions are both large and complex, even untenably so.
 This is partly because, as you pointed out, dynamic scoping makes large projects “interesting.” Is it not a sign of EmacsLisp’s flaws that we’re all desperately afraid of an attempt to rewrite EmacsLisp libraries?
 As you pointed out, Emacs is not primarily an editor, it’s known first and foremost as a “kitchen sink.” There’s a reason that the first word in its name is “Extensible.” I feel I should also mention a popular Microsoft anecdote. Microsoft, at some point in its office research, discovered that any given feature is really only used by a insignificant fraction of users – but if it’s taken out, that individually insignificant fraction becomes irate. By the time you trim Word down to its “primary application,” you’ve lost 99% of its users.
 The dogma comes through anyway.
Scheme is probably easier to implement than CL, because it is much, much smaller. But I definitely wouldn’t say that its standard has been written with optimization in mind. Following the book “Lisp in Small Pieces”, the existence of continuations as first class objects alone implies a performance penalty; likewise the fact that the first element of a form has to be evaluated, possibly at runtime; likewise the fact that scheme programs may overwrite built in functions. I guess that modern compiler techniques may be able to deal with that, I don’t know. But it is definitely not easy.
EmacsLisp’s lack of lexical scoping isn’t so much a matter of writing and maintaining large and complex programs. The byte compiler does warn you, if you access a dynamically bound variable outside of its let-form. You have to add a variable declaration in order to get rid of that warning.
There are two other reasons why I, at least, want lexical scoping: 1) it allows faster variable bindings and better optimization techniques. Introducing lexical scoping could vastly improve EmacsLisp’s speed. In fact the slowness of creating a dynamical environment urges people (myself included) to use such ugly constructs as (let (var) (while <condition> (setq var …))). This won’t be necessary with lexical scoping.
2) Lexical scoping is a requirement for closures. Closures would allow for a lot of very useful programming techniques.
In that context: ad Pipeline’s comment : I explained above, why I fail to see that EmacsLisp’s dynamical scoping “makes large projects ‘interesting’”. I hardly recall any problem comming up in emacs-devel or gnu.emacs.help that could have been attributed to dynamical scoping. So this point would require some extra arguments. After all, Emacs is a very large project. Moreover, I don’t understand why that would anybody make afraid of rewriting an EmacsLisp library in a different language – presumably one that does provide lexical scoping.
I strongly agree with Pipeline here. What does “editor” mean for the OP? Just writing ASCII text? Just writing text/plain in general? Just writing text/plain and offering special support for programming source code? Does “just an editor” include functionality like Tramp (for remotely accessing files)? If yes, why doesn’t it include a newsreader?
For me most of the so-called “kitchen-sink” stuff is simply part of an editor. There is a big benefit in having everything in a unified environment with a common user interfacec. If my editor would not provide functionality to read mail and news, then I’d drop it and look for a mail reader that let’s me edit programming text. In fact what the OP is attacking here is that Emacs is an Emacs, and not just an Emacs-like editor.
I didn’t know that “Emacs is dying” is a Terrible Secret of the Emacs community. If so then they haven’t told me in all those years. Well, yes, EmacsLisp sucks. And at the same time: EmacsLisp is a very nice language. A contradiction? Well, EmacsLisp is just lacking a few features and I’d wish by heart that they were introduced to that language: a few problems are mentioned above. But the most important problem is: speed. EmacsLisp (or rather its implementation, but that amounts to the same here) is too slow. Closures are lacking, too. Yes, a deeply integrated, efficient object-system would be necessary, too. Oh, and modules or a package system. And, as a personal wish of mine: tail call reduction.
Second of Terrible Secrets is discussed so often I doubt it’s a secret any longer (maybe it’s fact it’s secret that’s Terrible Secret :)). So here are my reasons why I want to see current Emacs code thrown out the window and rewritten (and most importantly, redesigned) from scratch. What we want to retain is Emacs-the-project, Emacs-the-team, Emacs-the-community, Emacs-the-spirit, and also, Emacs-the-name :). But actual source code should be redone, because:
What I envision is ultra small and lean core, that does only one thing - allows extensions to interface each other, binary objects and Lisp-written alike. Ideally, there shouldn’t be any difference between C and Lisp code, each should be overridable and changable by outside. This way, you could plug in different display engines on console and X, making it possible to introduce for example structured graphics manipulation primitives (another long-time wish of mine). That means to see and manipulate pretty UML figures, I don’t need to leave Emacs, and I can still use all the graphics capabilities offered by X I use, without making life hard for console users. And plugging Emacs into .NET would be matter of one extension that bridges between Emacs binary and runtime. Incidentally, that seems to be design employed by MonoDevelop?/SharpDevelop? IDE running on .NET, where core has astonishing size of 23KB, and everything else (including GUI) is a plugin. Yes, I know it’s not small undertaking. But I can’t see how could Emacs survive and grow in its current incarnation (unless we are content with I’m-too-hardcore-to-move-from-console users only and no new souls coming)
That’s my 3 cents, hope I was clear enough and managed not to offend anyone :). Oh, and I don’t say everyone and their dog have to use .NET for everything, I just say that modern programmer’s editor needs to be able to do that, or will get forgotten in world of runtimes everywhere.
 Yes, I know lame anime references are lame. But I couldn’t resist :)
I think Mathrick is on crack. 
Mathrick, you will want Eclipse. :)
Seriously, I tried that a few months ago. Still have the core but not much functionality. I’m not sure where such elementary things, like buffers, are supposed to be in that design. There’s one single static plugin, which can hold scripting engines, which in turn use the core library to communicate with each other. Different window systems are no problem at all, since you can just plug them in (need a streamlined interface though).
But then…there’s Eclipse and I think it does all of the above minus console modes (and it’s slow).
I’v been using Gnus for a short period of time (less than 2 months) and found the lack of threads quite annoying. The only hack that I could come up with was to make an idle timer that will scan for new mail once every 30 seconds or so. There is also a 3 minutes delay between consecutive scans to avoid useless request to the mail server. How hard would it be to add only one background thread that runs these idle tasks ? (We don’t need Emacs to be a scalable, multi-threaded web server :)) I guess it’s the same thing as adding support for any number of threads …
I think it’s quite funny that people never take into account the empirically observable reality. It’s like falling and staying in love with comunism besides real history.
Almost any kind of application I can think of, when there is an emacs mode for it, its always best in class. Going back from Emacs to other editors /IDE’s is like going back to the stoneage. If Scheme is so great - why is there no proof of it? Why is it possible to realize really complex extensions like org-mode and gnus in EmacsLisp, if it sucks so much? Where are better extensible programs in Java, Phyton, whatever?
I think it’s fun to program in Emacs Lisp, a huge project with a long history in this language yielded an unsurpassed piece of software (Emacs) - it can’t be bad, it must be very suitable for the task at hand.
Get over it. Emacs lisp is designed to be an extension language for Emacs editor. It is ridiculous to compare EmacsLisp to Haskel, Scheme and Common Lisp.