Vim and Emacs modelines
briancarper.net
briancarper.net
S-expressions are better than strings because they cleanly compose. You can write your big-long-sexp for the default menu, and I can use it as a part of my modeline without worrying about quoting.
You can see here that you can control a lot of Emacs' user-visible functionality simply by adding an association to this list. The programmer adds the cool routine to this code, the user gets a simple alias in `customize`.
I am really, really confused as to why this is a bad thing.
The deep issue here is that Emacs' behavior is built from composing fragments of programs. This means that you can change it as much or as little a you want. Vim just does stuff -- "Don't like it? Fuck you."
(I will also point out that it is a Simple Matter Of Programming to make Emacs support vim modeline definitions verbatim. Not as easy to do it the other way, is it?)
Vim is a highly configurable text editor built to enable efficient text editing.
GNU Emacs is an extensible, customizable text editor--and more.
The "and more" speaks volumes about the complexity of Emacs...
Programs are much easier to write than config files.
(Incidentally, emacs can be set up to act like vi with all of Emacs' editing commands available. To preempt the inevitable "it's not vim" comments, I'll point out that this tends to confuse vim users, who think that all "vi"s have the same commands that vim does...)
In general though I find the apples-and-oranges complaint about vim-emacs comparisons to be disingenuous. You may say, 'Oh, but emacs is much more than a text editor, so it's foolish to compare them directly!' but not everybody who's interested in choosing one or the other would necessarily have any interest in the OS-like capabilities of emacs. That is to say: there is still a very good reason to review emacs purely in its function as a text editor, even if that is not the full extent of its capabilities. Many, if not most, people in the market for a text editor aren't really interested in whether, after several years' learning the ropes, they might run a full Turing Machine in it.
It's great for making things consistent within a file when the editors people are using might not be consistent in their configuration. For example, I might be collaborating with one person who uses tabs with a shift width of 8, while in my own writing I may prefer to use 4 spaces.
So I can add:
/* vim: set noexpandtab:sw=8:ts=8 */
and suddenly vim will realize that it should treat an input of <tab> as a tab character and render them as 8 characters.Alternately, if I were writing a document where I wanted all lines to be automatically wrapped to be within 80 characters but I usually let them continue indefinitely, I could add
/* vim: set wrap:tw=80 */
and I quickly have a per-file way of setting my editor's configuration.For simple things, like tab width, it could be made compatible, however. Personally, I prefer a human-readable set of guidelines, then I just configure emacs (via eproject) to set things up correctly for each project. Not as easy, I guess, but then new files I create for the project have the right settings by default.
There's also ways to set directory tree specific variables as well, so you can override the defaults for all files in a particular project. Very handy.