help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: some vi equivalents please?


From: rustom
Subject: Re: some vi equivalents please?
Date: Wed, 5 Nov 2008 23:08:47 -0800 (PST)
User-agent: G2/1.0

On Nov 5, 6:41 pm, Ken Goldman <kg...@watson.ibm.com> wrote:
> rustom wrote:
> > 1. In vi I can delete a line that contains a <pat> with :g/<pat>/d
>
> Others have posted the best way do do this.  However, rather than
> searching for infrequently used commands, I typically just define a
> keyboard macro and replay it.
>
> In this case, the macro would be:
>
> - search for the pattern
> - go to the beginning of the line
> - kill the line

Well... I have some technical and some non-technical responses to
this.

Technical 1.
Your macro is not equivalent to the vi :g/<pat>/d unless it is
embedded into a loop.  The loop could be programmatic or interactive
(keep doing Cx e)

Technical 2.
Overall it turns out faster (without the infrequently used flush-
lines) to
Save-buffer in emacs
Finish off the 1 liner in vi
revert-buffer in emacs

Non-technical 1
I work in an environment where I am the old-timer using the strange
old clunky emacs. I have a hell of a time convincing my half-my-age
coworkers to use emacs.  Confirming the clunkyness (because I dont
know a command) does not help my cause :-)

Non-technical 2
Funnily enough, this requirement came up in a large scale edit that
required adding a single line to 200 classes in 37 files.  I did this
(for these coworkers) by writing 3 elisp functions that implemented an
iterator that sequentially went through the 200 classes.  Producing
the file:lineNo list of those 200 cases was where the original request
(for deleting lines) came up.

So, no, Im not averse to writing emacs macros or elisp code; just like
to use the right tool for the job.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]