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: Drew Adams
Subject: RE: some vi equivalents please?
Date: Mon, 3 Nov 2008 01:10:28 -0800

> Well Ok. Ive added somethings there and corrected some omissions.

Great. You can see from the activity on the page that it sparked some interest
and has no doubt helped others already.

> But there is one thing which is more appropriate here (I think)
> When I put n!!sort to sort the next n lines I was putting that merely
> as an example of a 2-way pipe.
> ie a command that takes its input from a bunch of vi lines and whose
> output goes in as a replacement.
> 
> Of course its good to know about sort-lines but that is hardly
> general. One could want sort|uniq or sort|uniq|pr
> with all kinds of unixy command-line args peppered in -- a unix-shell
> programmer never ceases to find new pipelines that he never had
> imagined before.

Not sure what you're asking here (and why here?). I didn't add `sort-lines' to
your table. Someone else did, presumably trying to help fill in the table. I
don't use vi, so I can't say whether it is appropriate or adequate.

But you are free to correct any info that someone enters - on pretty much any
wiki page. Go for it. You might want to mention piping with UNIX `sort'. You
might want to link to the Emacs manual, node Sorting (which see, BTW - there is
lots more than `sort-lines'). The choice is yours. The wiki is yours.

> Also Xah mentioned that flush-lines is obsolete compared to delete-
> matching-lines.

Nonsense. `flush-lines' is in fact the defun name. It is `delete-matching-lines'
that is an alias for `flush-lines'. But neither is obsolete.

You don't need to refer to Xah or Drew or anyone else for this. Just do `C-h f'
for each of `flush-lines' and `delete-matching-lines', and see what is said
about them. Or check the Emacs manual (it is only `flush-lines' that is
documented there, BTW, but both are listed in the Index).

But the doc strings and manual are not infallible. The source code (linked from
the `C-h f' display) and doc together are the best authority about what is.

But even what is is not necessarily what should be. Emacs is open - to you.
Often things are ultimately a matter of opinion and persuasion (and
customization). And Emacs evolves (and that evolution is not always linear or
progressive). But starting with the doc is always a good idea.

> Since Im hearing of both for the first time I'll leave
> it to others to decide which is the recommended name.

They are two names for the same command. Neither is the recommended name, AFAIK.
Use whichever you like. And even if one or the other were recommended, use
whichever you like. ;-)

> Frankly flush makes me think of fflush in C (or something less
> mentionable)

FWIW, if you enter the command name interactively, via `M-x', it is quicker to
use `flush-lines' than `delete-matching-lines'. `M-x flu TAB', five keystrokes,
suffices. Eight keystrokes are needed for `M-x dele TAB m TAB'.

Personally, I suspect that's one reason many people use `flush-lines'. Another
reason might be that "flush" has long been used in connection with purging
things like buffers. (Another reason might be that some people like to mention
unmentionables such as "flush" and "purge".)

On the other hand, `delete-(non-)matching-lines' has the advantage of being easy
to remember and perhaps more accessible to `apropos' because it uses `match'.

Take your pick. There is no right or wrong answer here. That's the only right
answer. ;-)







reply via email to

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