[comp.editors] vi vs. emacs

bph@buengc.BU.EDU (Blair P. Houghton) (08/02/88)

In article <12767@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
>In article <661@buengc.BU.EDU> bph@buengc.BU.EDU (Blair P. Houghton) writes:
>>I have a copy of the Ultrix-32 quick reference guide at my side always,
>
>Does it document the `_' command?  (_ acts like 0, but is line oriented
>rather than character oriented.)

Uh-oh, I got Torek on my case now...

I just looked for it.  '_' is identical to '^', and the guide lists
the latter.  I don't know how you can say it's line-oriented, though.
(Firstly, one doesn't expect such esoterica in this reference, it's
the sort of place where system calls are listed only by arguments
and declaration...)  I tried it out, and it just goes to the first
nonblank _character_ in a line (whereas '0' can send the cursor
to stand on a tab, '_' or '^' can't.)  Sounds like they're all
character-oriented to me...

The only thing that bugs me, and only rarely, is that vi doesn't unnerstand
that the first word in a line is right next to the last word in the
previous line: very annoying if you accidentally hit the <cr>, or bung
the last letter of a word, reflexively hit a space, and the autowrap
puts the <cr> in for you.

BTW, I just noticed (because I never looked before) that the 'ZZ' command
is not in there.  Makes me wonder, but not enough to go abuse my
paranoia with Emacs.  What do you do when you're eating a burger and
finishing a report?  I can do anything quickly with one hand (okay,
there's a straightline fer ya...).  Anybody know the hardest command in
Emacs to accomplish with one hand?  I'm not familiar enough with it
to know.  I'll go look for the hardest in vi, and meet ya at the summit.

				--Blair
				  "No-help is better than emacs `help`"

P.S. ...I think in vi the hardest is <ctrl-0D>...  nope!  I tried it:
you can do 0<ctrl-d> and it's the same."

bph@buengc.BU.EDU (Blair P. Houghton) (08/04/88)

In article <2679@mipos3.intel.com> nate@mipos3.intel.com (Nate Hess) writes:
>In article <661@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
>>I once went into the info mode of Emacs, saw the menu of commands [...]
>
>Did you try going into the on-line tutorial?  (C-h t)
>

Yeah, it was a worse abomination.  Someone had left the write-protect off
the original version, and I couldn't even read half the instructions.

Plus, if I'm looking for something to quickly alleviate a lapse
of function, I don't want to have to go on a major hunt through
the tutorial.

				--Blair
				  "No help is better than Emacs 'help.'"

merlyn@intelob (Randal L. Schwartz @ Stonehenge) (08/04/88)

In article <678@buengc.BU.EDU>, bph@buengc (Blair P. Houghton) writes:
| In article <12767@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
| >Does it document the `_' command?  (_ acts like 0, but is line oriented
| >rather than character oriented.)
| 
| I just looked for it.  '_' is identical to '^', and the guide lists
| the latter.  I don't know how you can say it's line-oriented, though.

Not quite.  Using the '_' as a target of a command is like doubling
the letter, hence it is redundant, and as such, undocumented.

For example, '5d_' is like '5dd', not '5d^'.  (I don't think the last
one works, but haven't invoked vi for more than 5 minutes in the last
two weeks, so I don't remember.)

A former vi hacker (converted to GNU emacs)...
-- 
Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095
on contract to BiiN Technical Publications (for now :-), Hillsboro, Oregon
<merlyn@intelob.intel.com> or ...!tektronix!ogcvax!omepd!intelob!merlyn
Standard disclaimer: I *am* my employer!

bph@buengc.BU.EDU (Blair P. Houghton) (08/05/88)

In article <12604@ism780c.isc.com> mikep@ism780c.UUCP (Michael A. Petonic) writes:
>In article <1186@ficc.UUCP> peter@ficc.UUCP (Peter da Silva) writes:
> >That's why I generally yank to a pattern. For example, "ay/^}^[ is a favorite
> >of mine. Also, how do you do >>% in Emacs?
>
>Well, you could write a lisp function to do it...

You gotta be kidding!

Go into recursive hades for eternity just to do yank'n'stuff?

Emacs is losing its edge...

				--Blair
				  "Don't need no more than the
				   <shift>, ^], and my return key..."

mikep@ism780c.isc.com (Michael A. Petonic) (08/06/88)

In article <715@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
 >In article <12604@ism780c.isc.com> mikep@ism780c.UUCP (Michael A. Petonic) writes:
 >>In article <1186@ficc.UUCP> peter@ficc.UUCP (Peter da Silva) writes:
 >> >That's why I generally yank to a pattern. For example, "ay/^}^[ is a favorite
 >> >of mine. Also, how do you do >>% in Emacs?
 >>
 >>Well, you could write a lisp function to do it...
 >
 >You gotta be kidding!
 >
 >Go into recursive hades for eternity just to do yank'n'stuff?
 >
 >Emacs is losing its edge...

Come, come.  Look at the following function to do exactly what is needed.
And, it even prompts for the parameters (unlike VI).  It isn't that hard.
Plus, before using Emacs, it had been 3 years since I used lisp.  I'm
rusty, but it's easy writing useful code.  Which just goes to show
you that in Emacs, if you don't have the function, you can write one.  Can
you read News inside of Emacs?  [ I could go on forever... ].  Anyway,
this function doesn't use recursion...

;; Function to yank to a regular expression.
(defun yank-to-re (reg re)
  "Yank into REG from the point until the point where RE is found."
  (interactive "cYank into register :\nsRegular expression :")
  (let ((ppoint (point)))
    (if (re-search-forward re)
	(set-register reg (buffer-substring (point) ppoint)))))

-MikeP
-- 
Michael A. Petonic				mikep@ism780c.isc.com

        ``When was the last time you dug a ditch, baby?''

chris@mimsy.UUCP (Chris Torek) (08/08/88)

>>In article <12767@mimsy.UUCP> I asked about a certain vi reference:
>>>Does it document the `_' command?

>In article <678@buengc.BU.EDU>, bph@buengc (Blair P. Houghton) answers:
>>I just looked for it.  '_' is identical to '^', and the guide lists
>>the latter.  I don't know how you can say it's line-oriented, though.

In article <3721@omepd> merlyn@intelob (Randal L. Schwartz @ Stonehenge)
notes:
>Not quite.  Using the '_' as a target of a command is like doubling
>the letter, hence it is redundant, and as such, undocumented.

Exactly (which was why I asked about it :-) ).  Apparently it is a
historical artifact.  Originally, one had to type `d_', `c_', y_',
etc., to effect a line-oriented delete, change, or yank of the current
line.  Mark Horton decided that `stuttering'---`dd', `yy'---was much
simpler.  (He was right.)  Nonetheless, the old command persisted,
and still does; it even has a somewhat reasonable use (see below).

>For example, '5d_' is like '5dd', not '5d^'.  (I don't think the last
>one works, but haven't invoked vi for more than 5 minutes in the last
>two weeks, so I don't remember.)

5^ and ^ are the same: both mean `go to the first nonblank character.'
`_' is `go to the n'th line with this line being ``1''.'  (Try `3_',
e.g.)  Going to a line implies moving to its first nonblank character.
For line-oriented operations, the character position within a line is
irrelevant, of course.

The one place I find the _ command useful is in feeding a particular
range of lines to a filter.  To filter three lines through `fmt', you
can either type `!2jfmt' or `!3_fmt'.  The former requires some mental
arithmetic.  (Okay, so it is hardly onerous :-) .)

Other less-well known vi commands include: `|' (acts like 0); `&'
(repeats the last substitute command, on this line only); ^N and ^P
(same as j and k); ^R (redraw, removing `@' signs on terminals without
line insert and delete; `set redraw' implies automatic ^R).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

usenet@nancy.UUCP (Usenet file owner) (08/09/88)

I cannot speak for the version of Emacs you are using, but Freemacs for
the IBM PC has, in addition to C-h t, a useful little gem:  C-h a.  It
prompts you for a string, and then returns all the command names with
that string as a substring.  It also has C-h b which will create a
buffer showing all the key bindings.  Together, the result is a
reasonably complete help facility.

Bill Su

nate@mipos3.intel.com (Nate Hess) (08/11/88)

In article <700@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
>In article <2679@mipos3.intel.com> I write:
>>In article <661@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
>>>I once went into the info mode of Emacs, saw the menu of commands [...]
>>
>>Did you try going into the on-line tutorial?  (C-h t)
>>
>Yeah, it was a worse abomination.  Someone had left the write-protect off
>the original version, and I couldn't even read half the instructions.

Hmmm.  Doesn't sound like the fault of Emacs, at all.  Get someone to
fix the write-protectedness of the file.

>Plus, if I'm looking for something to quickly alleviate a lapse
>of function, I don't want to have to go on a major hunt through
>the tutorial.
>
>				--Blair
>				  "No help is better than Emacs 'help.'"

Emacs' help is better than the help for any editor I have seen.  Try
typing 'C-h C-h C-h' (in response to prompts for additional help), and
you get something like:


You have typed C-h, the help character.  Type a Help option:

A  command-apropos.   Give a substring, and see a list of commands
              (functions interactively callable) that contain
	      that substring.  See also the  apropos  command.
B  describe-bindings.  Display table of all key bindings.
C  describe-key-briefly.  Type a command key sequence;
	      it prints the function name that sequence runs.
F  describe-function.  Type a function name and get documentation of it.
I  info. The  info  documentation reader.
K  describe-key.  Type a command key sequence;
	      it displays the full documentation.
L  view-lossage.  Shows last 100 characters you typed.
M  describe-mode.  Print documentation of current major mode,
	      which describes the commands peculiar to it.
N  view-emacs-news.  Shows emacs news file.
S  describe-syntax.  Display contents of syntax table, plus explanations
T  help-with-tutorial.  Select the Emacs learn-by-doing tutorial.
V  describe-variable.  Type name of a variable;
	      it displays the variable's documentation and value.
W  where-is.  Type command name; it prints which keystrokes
	      invoke that command.
C-c print Emacs copying permission (General Public License).
C-d print Emacs ordering information.
C-n print news of recent Emacs changes.
C-w print information on absence of warranty for GNU Emacs.


There is an entire, indexed, cross-referenced Emacs manual available
on-line if you type 'i' at this point.  This goes into Info mode, which
allows you to browse documentation quickly and easily.  There is a
"primer for first timers" available once you get into Info mode.  Give
it a try.


There are some editors (vi, for example) that are user-hostile.  There
are some users that are system-hostile.  (Hi, Blair!)  You can either
bitch and complain, or you can experiment and *learn*.

"If you plant ice, you're gonna harvest wind..."

--woodstock
-- 
	   "How did you get your mind to tilt like your hat?"

...!{decwrl|hplabs!oliveb|pur-ee|qantel|amd}!intelca!mipos3!nate
<domainish> :   nate@mipos3.intel.com		ATT :    (408) 765-4309

bph@buengc.BU.EDU (Blair P. Houghton) (08/26/88)

In article <2716@mipos3.intel.com> nate@mipos3.intel.com (Nate Hess) writes:
>In article <700@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
>>In article <2679@mipos3.intel.com> I write:
>>>In article <661@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
>>>>I once went into the info mode of Emacs, saw the menu of commands [...]
>>
>>				--Blair
>>				  "No help is better than Emacs 'help.'"
>
>There is an entire, indexed, cross-referenced Emacs manual available
>on-line if you type 'i' at this point.  This goes into Info mode, which
>allows you to browse documentation quickly and easily.  There is a
>"primer for first timers" available once you get into Info mode.  Give
>it a try.

As you see above, it was the impossible-to-bother-with, entirely new
and different (read: superfluous) set of commands for the dinging
"info mode" that made me decide that emacs is someone's idea of
full employment for inefficient software engineers.  

I posted an article in comp.misc a few days ago in which I winsomely compared
programming languages to automobiles.

Here's such a thing:

ed is a vw bug
ex is a vw rabbitt
vi is a vw scirocco (with convertible roof down, stuck down... :-)

emacs is John Madden's CBS-provided travelling bus, but saddled with a
gas stove, bulletproof windshield wipers, separate radios for each
station, ZX-81 computer with two keyboards (both stuck in cyrillic mode),
redundant drivers, swimming pool, velodrome, pigeon coop, kitchen sink...

Capiche?

Oh, yeah, and if you push the red button on the left of the dash, Madden's
bus can rebind all its rivets to _emulate_ the scirocco, but I don't see
the scirocco people climbing all over themselves saying it can do
the converse.

				--Blair
				  "Guns don't kill stories,
				   editors kill stories..."
				   -Hildy Johnson

weemba@garnet.berkeley.edu (Obnoxious Math Grad Student) (08/27/88)

In article <926@buengc.BU.EDU>, bph@buengc (Blair P. Houghton) writes:
>As you see above, it was the impossible-to-bother-with, entirely new
>and different (read: superfluous) set of commands for the dinging
>"info mode" that made me decide that emacs is someone's idea of
>full employment for inefficient software engineers.

I like Blair.  It's people like him who make so many of us feel like
such amazing bloody brilliant geniuses, if for at least five minutes
a day.

Ain't Usenet wonderful?

ucbvax!garnet!weemba	Matthew P Wiener/Brahms Gang/Berkeley CA 94720

mikep@ism780c.isc.com (Michael A. Petonic) (08/27/88)

In article <926@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
 >In article <2716@mipos3.intel.com> nate@mipos3.intel.com (Nate Hess) writes:
 >>In article <700@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
 >>>In article <2679@mipos3.intel.com> I write:
 >>>>In article <661@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
 >>>>>I once went into the info mode of Emacs, saw the menu of commands [...]
 >>>
 >>>				--Blair
 >>>				  "No help is better than Emacs 'help.'"
 >>
 >>There is an entire, indexed, cross-referenced Emacs manual available
 >>on-line if you type 'i' at this point.  This goes into Info mode, which
 >>allows you to browse documentation quickly and easily.  There is a
 >>"primer for first timers" available once you get into Info mode.  Give
 >>it a try.
 >
 >As you see above, it was the impossible-to-bother-with, entirely new
 >and different (read: superfluous) set of commands for the dinging
 >"info mode" that made me decide that emacs is someone's idea of
 >full employment for inefficient software engineers.  

Blair, get a brain.  I was trying to hold back from flaming you,
but your ignorance and your beligerant attitude make flaming
you a too pleasurable task.

I've seen some engineers out of Boston U., and I daresay they are
a lot sharper than you are.  What happened to you, get in on
a mental hardship scholarship?

If you can't learn a simple damn editor like emacs, how can a
manager expect you to perform well on a job.  All you've been
doing in comp.emacs is telling us about your failings and your
lack of adequate numbers of brain cells.

Look, a lot of people use emacs.  Why?  Because they find it powerful
and flexible.  It tops VI in those two catagories, hands down.
And I've never seen anyone who wasn't a fool try to refute this.
However, it's a little bit more complex than VI and that's the
price you pay.

I learned Emacs in a lull between projects.  Since I had somehow
managed to escape the attention of any managers who had
grunge work to do, I set out upon the task of learning emacs.
It took a week to get used to it, and get my lisp back to
par so that I could write some pretty simple functions.  Yeah,
it took a week out of my time, but that's only 2% of a
year's productivity, and it probably has increased my productivity
by at LEAST 15%.

So -- quit your bitching.  If you don't want to learn Emacs, that's
fine.  But don't bother us about what a mental wimp you are, ok?
We learned it.  I hear Boston has some pretty good "Special Education"
programs that you might want to enroll in.

Oh, one more thing....  You philistine.  Geez, I've always
wanted to use that in a flame.

-MikeP
-- 
Michael A. Petonic				mikep@ism780c.isc.com

       ``Living in the pools, they soon forget about the sea.''