Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like Emacs because it's a live programming environment focused on the editing of text.

As far as I know, there is no other editor with this capability. Sure, they all let you write "plug-ins" but none of them let you do your work by writing code interactively, alongside normal editing commands and GUI operations. As a programmer, this is how I want to do everything with my computer.

I don't have many customizations (I have something to move lines with the alt-key like Eclipse, and I swap parens and square bracket keys so it's faster to write Lisp) and I don't even know many keyboard shortcuts, but I write bits of Elisp all the time to perform large scale text manipulations, generate Java and html boilerplate at work etc. Having everything happen inside my editor, being able to use an editable buffer as an ad-hoc input source to a program just makes everything more fluid and interactive than doing the same thing with scripting languages on the command line.

It kind of baffles me that the Emacs people don't push this angle very much. There's hardly anything about it on the website. You'd think Emacs was just another editor with hundreds of keyboard shortcuts and a strange gui.



> As far as I know, there is no other editor with this capability.

Well, to some degree Vim can do this too. It doesn't let you "eval" a function you just typed into a buffer, but it can eval a vimscript file that you just edited. Including the vimrc, but just like Emacs' init.el reloading it doesn't actually reset the state. But where Vim can't just eval a whole function you can write very complex keybindings on the fly in a much simpler syntax, which made up for it in a few situations for me.

And it's very similar in how the configuration and plugins work - it's all just a scripting language spread across files, and instead of having separately developed plugins you just write a function and run it, more or less.

Emacs is more flexible still, but with its own quirks.


I'm not that surprised. It's the sort of thing you won't appreciate until you've tried it. Ask people what they want, and they'll tell you "a faster horse". Ask people what they want, and they'll tell you "a better editor" so that's how Emacs markets itself.

Unless you've tried one, "a car" or "a fully dynamic, programmable editing environment" is just not on people's minds.


I don't understand it. Any examples how to do that in practice? (used emacs for a couple of years, but just as a editor)


The question is almost like asking a fish to describe water. It's the sudden lack of it that produces a really clear example. :)

Anyway, here's a random example that comes to mind: I have some sexps in a Lisp file and I want to sort them alphabetically. Each sexp (usually a top-level form, but not necessarily) usually spans multiple lines, so line-sorting won't do it. Since they may be top-level forms, there may be comments between them that would lose their context if their position relative to sexps were lost, so comments need to "stick to" sexps they're above.

How would you solve this in a random text editor?

In Emacs, I would develop a command that does what I need. At each stage of the development process, I evaluate the command's definition, and it's instantly available to be used and tested. I could even test the function on its own definition, if I wanted to be silly (undoing the sorting after testing, of course).

When I'm done, I save the command definition to my configuration, and it's now a permanent tool in my toolbox. I didn't have to recompile the editor and start a new process, nor did I have to submit a patch to an upstream and ask for it to be merged. Similarly to a carpenter (forgive me if it sounds silly), my editor is my workbench, and as wood is malleable, so is my editor.

So, here's the command I came up with (maybe not the prettiest implementation, but maybe not the worst): https://github.com/alphapapa/unpackaged.el#sort-sexps And using Emacs and Org mode, I publish it into this "unpackaged" package, which I then install into my configuration as a package, and other users can then easily install it into theirs, too.

I don't know of any other editor that can do all of this, certainly not so easily.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: