You are viewing liam_on_linux

Sun, Jan. 27th, 2013, 04:55 pm
ErgoEmacs: Emacs, dragged kicking & screaming into the 1990s!

I have long had a (very) idle dream about learning enough eLisp to convert Emacs, which I gather is quite phenomenally powerful and all that -- Neal Stephenson says so and he is as a god to me -- into an actual usable modern editor. I.e. something that looks and works like Notepad or Gedit or MS-DOS Editor: a basic CUA interface, because those are the keybindings I have been using since the end of the 1980s and they are now indelibly burned into my muscle memory.

But someone has gone and done it already.

I've been experimenting a little. It's Emacs, but it actually works with the same keystrokes as every other editor for the last 20+ years. It's amazing.

And unlike the lovely Aquamacs, it doesn't need Mac OS X.

I am not sure I have the flexibility to adapt any more, but I am liking what I am seeing. There's a monster lurking behind this friendly face, but it gets me over the initial hump that none of the editing keystrokes I use daily on Windows, Macs and Linux alike work any more on Emacs.

Aside: don't suggest Vi. I can use it for the very basics, but then again I could probably type with my nose if I had to. I choose not to because it's slow and unpleasant. It is not even as modern as MS-DOS Edit - it's a vestige from the 1970s. I remember using text editors on VAX/VMS nearly 30 years ago and having to flip from edit mode to command mode and back all the time. It was crap then and it's intolerable now; I don't care how many other features it has, the basic operating mode is a POS.

Sun, Jan. 27th, 2013 05:17 pm (UTC)

#insert std-vi-emacs-flame-war.h

Sun, Jan. 27th, 2013 07:19 pm (UTC)

True enough.

But I am not on either side, really. Broadly, I've hated them both since I first encountered them.

I managed to learn enough vi to make simple edits in the '80s. I have never learned to do anything more. I can't cut & paste or anything, which I could do even in WordStar.

When I tried to learn that much Emacs, it defeated me.

Vi is on every Unix box in some form, ISTM. Emacs isn't. So I learned the absolute minimum of Vi and that is all.

But I find essays like Stephenson's persuasive. Smarter people than I tell me that Emacs is the most powerful text editor in the world, ever, even for those who write English rather than code. And I spend a lot of my time writing English, and I don't /really/ like Microsoft Word or LibreOffice Writer that much. Word became pants as of Office 2007; LibreOffice is all right, but as I've discovered on my course, its table handling sucks. (So does that in Word 97, my preferred version, I now realise.)

It's made me think of taking a retrograde step, back to a simple text editor instead, and the consensus of the wise old heads seems to be that Emacs is The Editor.

Sun, Jan. 27th, 2013 07:46 pm (UTC)

> But I am not on either side, really. Broadly, I've hated them both since I first encountered them

Not really hated them, but I've certainly never really got on with either of them myself and always preferred to use JOE as my editor of choice. (Which is very easy to use if you are familiar with WordStar. :) )

Sun, Jan. 27th, 2013 10:42 pm (UTC)

I was once, but I really, really don't want to go back. Really.

TBH I didn't like it at the time. I didn't like WordPerfect much, either.

Things like block-highlighting for cut&paste as well as formatting just make sense to me.

Sun, Jan. 27th, 2013 09:00 pm (UTC)

> Vi is on every Unix box in some form

Just so... which means that it's more powerful than Emacs -- you can't edit a file using Emacs if it's not installed, whereas you probably can with vi, because it probably is.

For which reason I became familiar with vi in about 1983 and have been using it more-or-less exclusively ever since. I never found anything that I wanted to do in a text editor that I couldn't do with vi, so I never found a reason to try another -- until I started using Windows, where Notepad was more widely installed than vi (I didn't come to PC compatibles until after the advent of WIndows 3, so I only used Edit when I had to change files in DOS without Windows running). These days, of course, all my Windows machines run vi under Cygwin -- so life is much easier.

But this is all covered in the include file I mentioned earlier.

> actual usable modern editor. I.e. something that looks and works like Notepad...

In vi, I can do global search-and-replace using general regular expressions, which I can't do in Notepad and others. I can choose line ranges for my search-and-replace. I can pipe parts of the file through external filters and re-insert the results in the same file... without leaving the editor. Which I can't do in Notepad. In vi I have 26 distinct clipboards to/from which I can copy/paste -- if I'm running under X-windows, I have 28 including the system clipboard and the selection clipboard, whereas in Notepad I have only one. I can have named ranges that I can jump to, which I can't do in Notepad. And ... and ... and. And.

But this is all covered in the include file I mentioned earlier.

Sun, Jan. 27th, 2013 09:08 pm (UTC)


(All the things I can do in vi that I can't do in Notepad, I can't do in MS-Dos Edit either).

Sun, Jan. 27th, 2013 11:47 pm (UTC)

I posted about ErgoEmacs on a mailing list I'm on & a commenter there has also had a go at me for dissing Vi, pointing out that modern GUI versions are no longer modal. This is a good point and something I'd forgotten, as I pretty much only use it in a Unix shell of some form. He too praises it very highly for its power, something I'd not dream of disputing, and comments that as a professional programmer he uses it every day.

This brings up an interesting difference that I'd failed to address. I said...

I was and am looking for a text editor for writing actual text, as in,
English, not program code. It might very occasionally get used for
config files but that is about it.

So all the much-vaunted advantages of many editors in terms of syntax
highlighting, code indentation, etc. are all utterly wasted on me. I'd
be typing words in it, just like I am now.

I don't know if this would change your recommendation.

I have heard people say that they /can/ write human language in Vi; I
don't think I've ever heard anyone /recommend/ it for this, whereas to
my surprise, that happens regularly with Emacs.

Mon, Jan. 28th, 2013 09:34 am (UTC)

I didn't mention syntax highlighting or code indentation above, there's nothing to change in my recommendation. Except for the unrelated new point I'm just about to add as a new top-level comment.

I routinely write human language in vi (note lack of capitals), but often the human language I'm writing then gets put into a program intended for more than just text (such as a page layout system), and sometimes I type directly into that program.

> I don't think I've ever heard anyone /recommend/ it for this

See my new comment below.

Sun, Jan. 27th, 2013 10:46 pm (UTC)

I would not dare to disagree. I never accused Vi of lacking power, especially not in its modern form.

It's just the basic underlying concept - the modal editor, with editing-mode and command-mode - is something I remember with great distaste from the pre-GUI days. I didn't like it then and I like it a lot less now.

Modes are bad. Don't Mode Me In, dude!

Larry Tesler is also as a god to me, or would be if I remembered him more often.

Sun, Jan. 27th, 2013 09:23 pm (UTC)
livejournal : Text Editors

User dougs referenced to your post from Text Editors saying: [...] This is a question about what you use when you want to edit a file that contains text. [ Context [...]

Mon, Jan. 28th, 2013 09:41 am (UTC)

A new point, and one on which I might wish to base my actual recommendation:

One of the most powerful features a text editor can have is familiarity. Discuss.

Oh, wait, that's more-or-less you were saying right at the start about keybindings and muscle memory. And the things that are burned into my muscle memory are flipping from edit mode to command mode and back (because, after all, in a text editor you do two kinds of things; typing text, and manipulating text in other ways), putting text into multiple distinct named buffers, navigating to distant parts of the file by context, and doing versatile transformations with regular expressions. Using sequences of keystrokes that you can use everywhere else on a Unix/Linux/cygwin system in tools like grep and sed.

Looks like we're just familiar with different editors. Goodness me.

Tue, Jan. 29th, 2013 10:50 pm (UTC)

A fair point & I can't deny it.

It may be our different-worlds thing.

I learned wordprocessing & text editing on a Sinclair Spectrum, then moved to a VAX, then an Amstrad PCW. All pretty different.

Then it was over to PCs & soon after Macs. Macs are Macs - the same basic commands & keystrokes worked in Word, Jazz, More!, WriteNow, MacWrite, MacAuthor, &c. &c. PCs in the days of DOS were horrid - I had to learn the totally different command sets of WordStar, WordStar 2000, WordStar 1512 (a version of Wordstar Express) - yes, all totally different - & DisplayWrite, MultiMate, Word 3, WordPerfect, Samna Executive & others I've probably blanked. (& of course almost any app with an inbuilt text editor.)

I had to support all of those, so I had to know them. I also learned vi on SCO Xenix around then.

That would be around '88-'89.

Then in '90 it all started to change. MS-DOS 5.0 came out with its fullscreen editor, EDIT.EXE, which actually called QBASIC.EXE with the BASIC interpreter turned off, IIRC. & Windows 3.0 came out & soon everyone with a half-decent PC had it.

& all those weird DOS apps started to melt away like frost on a sunny day. Even DOS apps went CUA: Word 5.5 did, Works did at some point.

& within about 1y, just about all the apps I supported & worked with worked the same way. Shift-left & shift-right selected for cut/copy/formatting-where-appropriate. Alt-F, O opened a file. Alt-F, S saved it.

So, yes, I knew vi back then too, & I could have just devoted some effort to learning it - but I didn't, because within about 2y of me having it before my mildly-traumatised eyes & fingertips for the first time, every other text-editing app in the whole world of computing changed to be CUA-compliant.

Unix being Unix, of course, it took until about 1997 for KDE 1.0 to come along & bring the same sort of apps, & the same editing keystrokes, to Linux, which I am afraid is the first point at which I started taking it seriously: until then, it was just an unpolished, less-stable replacement for SCO OpenServer, or UnixWare if you were a bit funny in the head. (Or Solaris or AIX if you were really extremely rich.)

This is the thing. It's not just about what you choose to use. I didn't exactly choose a career in support - it sort of chose me. It's what I could do that paid best.

But as of about 23y ago - & it wasn't a new thing then, that's just the cusp, when it started to gather speed & sweep all before it - all editors have been like this, apart from a couple of - excuse me but I am not going to be polite here - a couple of eccentric, outré legacy tools, whose adherents have long tried to persuade me (& a million other Windows & Mac users, i.e., the mainstream of computing) that their extreme power makes it worth learning their arcane 1970s command sets.

Well, no it doesn't. I'm sorry but it just doesn't. I don't have a free choice of tools. I have to work on whatever is in front of me. Everything from my last smartphones with keyboards to pure cloud apps like Gdocs uses the same basic command set now, except vi & Emacs.

& now someone has put Emacs in a half-nelson & forcibly grafted the same UI onto it. & that's why I am interested. Because no matter how desirable a tool, if it works completely unlike every other editor on the planet then I am sorry but I am not interested.

I realise this does not apply to everybody, but dammit, it does not just apply to me, I am pretty sure. I think it applies to an awful lot of people. There are far more Mac & Windows users than Emacs & vi users out there. No we should not have to change. Why should we? The CUA command set is actually tried, tested, polished & efficient these days. It works. It works well.

The argument that we should go learn another, an admittedly very idiosyncratic & elderly one from some 40y ago, just to have the dubious privilege of using a very mature, very powerful editor?

No. Not for 1sec, not for an eyeblink. No. No more than I'd go back to using WordStar now. (Sorry hobnobs . That also includes Wordstar-work-alikes.)

No. There is a standard UI for editors now & has been for a ¼ century, give or take. Comply or get lost.

Tue, Jan. 29th, 2013 11:27 pm (UTC)

There is a standard set of command-line options and commands for text processors (grep/egrep/fgrep, sed, awk, ed, em, ex and vi), and has been for 43 years. Comply, or chose another alternative that you're familiar with.

Edited at 2013-01-29 11:29 pm (UTC)

Tue, Jan. 29th, 2013 11:43 pm (UTC)

No, there's a set of somewhat-standardised Unixisms that work across most Unixes most of the time, and there is what is, these days, *the* standard command structure that works on *everything* INCLUDING Unix if you're working at GUI level.

I wasn't coming here for the standard 5min Emacs-v-vi slanging-match, honest.

My point was not Emacs vs vi. I have no investment in that; I dislike both, but actually, I can open, edit and save a file in vi which is more than I can do in ordinary Emacs. (Self-documenting editor, my left testicle; it says use a Meta key when I haven't got a Meta key & have never seen a computer that does, but it also says that Ctrl is "C", when manifestly C is the one between X and V so long as you have Shift held down. Fuck that shit, as I believe the children say.)

No, my point was this rather different one:

"Hey, look, of the 2 great Unix text editors, one of 'em has, after a quarter of a century or so, come around to working like every other text editor on the planet, to a reasonable approximation. I may actually be able to use the thing now!"

And no, slapping a menu bar on it isn't coming around - they did that to both Emacs and vi years & years ago. And there's XEmacs and so on. No, the point is the slightly more subtle stuff - the Alt-keystrokes, the highlighting/cutting/copying/pasting behaviour and so on.

One of 'em has finally come in from the cold. It may make a difference. It would be interesting if it did.

Me, I still want it to look like this:


P.S. No, I do not actually want my text editor to be able to play background music at me. But you must admit, that'd be a very Emacsy sort of thing to do.

Tue, Jan. 29th, 2013 11:28 pm (UTC)

(Certain grammatical solecisms due to a serious refactoring to get it under 4300 characters.)

Tue, Jan. 29th, 2013 11:33 pm (UTC)

I spend most of my working life (apart from those parts that I spend in front of Windows servers) in front of Linux servers, which don't have CUA editors but do have vi. And therefore vi is part of my mandatory clueset, just as CUA is part of yours. No argument, we just work in different environments.

Tue, Jan. 29th, 2013 11:47 pm (UTC)

Yup, as I (belatedly) acknowledged.

And you're right, especially these days, I could run vi on virtually anything. Emacs ditto. I don't actually want to - I just want one of 'em to play nice with the muscle-memory I've been building up since I was about 22.

I still remember those days vividly (as old people are wont to do.)

It was an almost physical relief when I stopped having to remember if it was Shift-F7 or /WS or Esc-T-S or ^KS to save and could just go Alt-F, S - or failing that, use the mouse to do the same thing - regardless of what program I was in on whatever OS. It was SO GOOD. Finally, the nasty was going away. Finally, common sense was prevailing.

Of course, an incalculably vast number of new nasties have come along since, ones I couldn't even imagine. But CUA was *such* a good thing.

So I am somewhat excited at one of the 2 big editing heavyweights joining the party.

Mon, Jan. 28th, 2013 09:46 am (UTC)

( I just typed :q to close this tab instead of ctrl-F4)

Tue, Jan. 29th, 2013 11:29 pm (UTC)

I thought this might amuse...

Pirate Dave

"getting hideously stuck inside vi, unable to recall the correct exit keystrokes, and so trampling all over the edit I have just made."

That sounds like a normal vi session for me. The only thing more unbearable than vi's wonderful interface (do I hit "ESC" or ":" now?) is trying to reverse-engineer what RMS was tripping on when he wrote emacs. Nano is almost always the first thing I install on a new Linux box. It helps make life worth living as a Linux admin.

Greater context:

Tue, Jan. 29th, 2013 11:48 pm (UTC)

Re: vi...

My usual strategy with vi was to hit the 'esc' key if I couldn't remember what state I had left an edit in or if I had hit a number of keys before noticing that I wasn't in insert mode. The best vi error came about when I set up up linux box at work to provide a DNS server for our team to access some customer IPs that had changed.

After a weeks holiday, I came back to find it not working. A collegue had 'just edited the hosts file with some new entries' and the system hung when booting. After booting with a CD and mounting the system disk, it turned out that the host file was about 2M in size. It contained several hundred copies of the original. When inetd tried to load, it read the hosts file and fell over with lack of memory (it was quite an old version of Mandrake). Rather than use the usual ':wq' to exit, my collegue had used some fancy set of control keys which, although they wrote the file out and quit, also managed to replicate the entire buffer several hundred times.

vi became a lot easier to use with the easy cut and paste in PuTTY. I admit to the crime of copying the buffer, pasting it into Windows Notepad, editing and pasting the result back.


Tue, Jan. 29th, 2013 11:52 pm (UTC)

And more...

Paul Hovnanian
Re: The vi thing

Trouble with the vi UI? I don't believe it! What could be simpler?


Disclaimer - These opiini^H^H damn! ^H^H ^Q ^[ .... :w :q :wq :wq! ^d exit X Q ^C ^? :quitbye CtrlAltDel ~~q :~q logout save/quit :!QUIT ^[zz ^[ZZZZZZ ^H man vi ^@ ^L ^[c ^# ^E ^X ^I ^T ? help helpquit ^D man quit ^C ^c ?Quit ?q CtrlShftDel "Hey, what does this button d..."