On Thu, Jul 04, 2019 at 11:47:50PM +0200, ropers wrote:
> Do I understand correctly that this is in reference to these parts of man 1 
> ed:
> 
> > /re/
> >    The next line containing the regular expression re. The search wraps to 
> > the beginning of the buffer and continues down to the current line, if 
> > necessary. ???//??? repeats the last search.
> 
> > ?re?
> >    The previous line containing the regular expression re. The search wraps 
> > to the end of the buffer and continues up to the current line, if 
> > necessary. ???????? repeats the last search.
> 
> and:
> 
> > (1,$)g/re/command-list
> >    Applies command-list to each of the addressed lines matching a regular 
> > expression re. The current address is set to the line currently matched 
> > before command-list is executed. At the end of the g command, the current 
> > address is set to the last line affected by command-list. If no lines were 
> > matched, the current line number remains unchanged.
> >
> >    Each command in command-list must be on a separate line, and every line 
> > except for the last must be terminated by a backslash (???\???). Any 
> > commands are allowed, except for g, G, v, and V. A newline alone in 
> > command-list is equivalent to a p command.
> 
> 
> If yes, then the corresponding parts of ed.1 are:
> 
> .It / Ns Ar re Ns /
> The next line containing the regular expression
> .Ar re .
> The search wraps to the beginning of the buffer and continues down to the
> current line, if necessary.
> .Qq //
> repeats the last search.
> .It Pf ? Ar re ?
> The previous line containing the regular expression
> .Ar re .
> The search wraps to the end of the buffer and continues up to the
> current line, if necessary.
> .Qq ??
> repeats the last search.
> 
> and:
> 
> .It Xo
> .Pf (1,$) Ic g No /
> .Ar re No / Ar command-list
> .Xc
> .Sm on
> Applies
> .Ar command-list
> to each of the addressed lines matching a regular expression
> .Ar re .
> The current address is set to the line currently matched before
> command-list is executed.
> At the end of the
> .Ic g
> command, the current address is set to the last line affected by command-list.
> If no lines were matched,
> the current line number remains unchanged.
> .Pp
> Each command in
> .Ar command-list
> must be on a separate line,
> and every line except for the last must be terminated by a backslash
> .Pq Sq \e .
> Any commands are allowed, except for
> .Ic g ,
> .Ic G ,
> .Ic v ,
> and
> .Ic V .
> A newline alone in command-list is equivalent to a
> .Ic p
> command.
> .Sm off
> 
> I'm not actually sure how to rewrite that. Would this call for
> separate /re, ?re and (1,$)g/re entries, or would it suffice to say
> that the second question mark or slash can be omitted if immediately
> followed by a newline?
> 
> Does anyone else have any ideas?
> 
> NB: In case people haven't seen it, here's an excellent ed(1)
> tutorial: https://sanctum.geek.nz/arabesque/actually-using-ed/
> I just thought I'd mention that.
> 
> Ian
> 

hi.

if we were going to document it, i'd say it definitely wouldn;t warrant
adding separate entries. it would be enough to describe when the / or ?
were optional.

neither freebsd nor netbsd seemingly document this.

posix documents it for /re/ and ?re?, but not g/RE/command-list, like
this:

        In addition, the second <slash> can be omitted at the end of a
        command line.

without having tested any of this, i guess we'd want to add such a note
to /re/ and ?re?, but not g/RE/command-list. something along the lines
of:

        The second slash is optional when followed by a newline.

you could ping a diff to tech, and see if anyone has any input that
could help. if no one does, i'll take it.

jmc

Reply via email to