3 ms·
This kind of loses me towards the end. I mean, sure, emacs is a freakishly large lisp program. I get that part. But, what's the point here? The abstractions
by ajross 18y ago
This kind of loses me towards the end. I mean, sure, emacs is a freakishly large lisp program. I get that part. But, what's the point here?
The abstractions in emacs (modes and hooks are the ones discussed in the linked post) really aren't that strange, or unique, or even lisp-specific. Nor are they without analogs in other tools written in conventional imperative languages. An emacs written in python, frankly, wouldn't look that different. A mode by any other name would hook as smooth.
- jrockway 18y agoEmacs is mostly impressive because it's a million lines of lisp with no lexical variables or namespaces. Emacs lisp has almost all the flaws that we criticize PHP for, but somehow it is actually useful and maintainable. I think that's interesting. An emacs written in python, frankly, wouldn't look that different. You're right, but I just can't imagine that. When I think of editing text, I think of writing Lisp to do it for me. I just can't comprehend doing it any other way... and my primary language is Perl :)
- JesseAldridge 18y ago"An emacs written in python" Such as http://peppy.flipturn.org/ http://peppy.flipturn.org/
- ken 18y agoYou're right that the features he mentioned seemed to not be terribly unique to Lisp. But note that your claim wasn't really true before Python 2.5 (less than 2 years old). Imagine trying to write one of Emacs Lisp's most common special forms, save-excursion, in Python without context managers. Even (especially!) Python programmers would admit that Python 2.5 is more powerful than Python 2.4. Emacs has a million lines of Lisp written with this feature not easily emulated in Python 2.4. The Lisp in my Emacs here uses save-excursion 9000 times; is there any Python program in the world that uses context managers 9000 times yet? I'm impressed that a 20+-year-old language can hold its own with a 21st-century one under active development by somebody willing to (somewhat) break backwards compatibility. That's not to say that Elisp was this great 20 years ago -- it had, what, one kind of loop? -- but macros let it grow in directions that its users wanted. You can't really add editing-specific features with custom syntax to Python.
- jrockway 18y agosave-excursion could just be a function though. Here's what the implementation would look like. I don't know Python syntax, so I'll use Lisp, but I'll keep Python's featureset in mind. No macros, no lambdas. (defun save-excursion (function) (let ((point (point)) (mark (mark)) ...) (funcall 'function) (set-mark mark) (goto-char point))) Then you would say: (defun do-something nil (...)) (save-excursion 'do-something) Ideal, no. Possible, yes.
- jrockway 18y agoThat should be (funcall function). I shouldn't post code before I have coffee :)