bug-ed
[Top][All Lists]
Advanced

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

Re: A suggestion to add to gnu ed: command line option to start on line


From: Antonio Diaz Diaz
Subject: Re: A suggestion to add to gnu ed: command line option to start on line foo or bar.
Date: Mon, 27 Feb 2023 16:05:32 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14

Matthew Polk wrote:
I like ed. I think it's a cool editor. One thing that in my opinion to
make it more usable with other programs would be to have implemented,
is a command line option to have ed automatically start at the
specified line rather than at the very bottom.

John Cowan wrote:
I would suggest doing this in an `ex`-compatible way.  That is, the command
line argument +n causes the current line to be n, and the command line
argument +/pattern causes the current line to be the first line matching
the pattern.

I have already implemented that. In addition I have also implemented +?pattern to set the current line to the *last* line matching the pattern. It took some time because I needed to modify some regular-expression parsing functions of ed that required the input to end in a newline. I am now writing some tests because testing command-line options does not fit in the current testsuite of ed.

When 'n' is beyond the last line, I have made ed to remain at the last line. But I would like to know what do you think it should be the behavior when there is no match for 'pattern'. I have made ed to immediately exit with error status 1, but I can change that behavior if something better (and not misleading) is suggested.

Best regards,
Antonio.



reply via email to

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