[nmh-workers] Unnecessary dependency on vi???

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
77 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Paul Fox-3
andy wrote:
 > Thus said Paul Fox on Tue, 13 Mar 2018 09:50:24 -0400:
 >
 > > well, part of  me wants to take  offense at that, since  it's not like
 > > vim is completely  compatible with the "real" vi. nvi  is much closer,
 > > in that regard, and should really be  the rewrite that gets to use the
 > > /usr/bin/vi name.
 >
 > As a long-time  nvi user, I'm always annoyed that  vim doesn't work more
 > like vi. :-)

:-)  I confess I haven't used nvi much, but I got the impression from
Keith Bostic (completely unbiased, I'm sure :-) that he'd done a pretty
good job on compatibility.  The big exception that I remember was his
implementation of infinite undo using '.', which broke a corner case
of the redo command, but is so easy to use.  I shamelessly stole that
UI when I implemented infinite undo in vile, and still love it.

On the other hand, I'm impressed that anyone can even remember what
"real" vi was like these days, given how long its been since most
people used it.  though I suppose Solaris still ships it.  For a
couple more years.

paul
=----------------------
paul fox, [hidden email] (arlington, ma, where it's 36.3 degrees)


--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Andy Bradford-2
Thus said Paul Fox on Wed, 14 Mar 2018 14:59:57 -0400:

> The big exception  that I remember was his  implementation of infinite
> undo using '.', which broke a corner  case of the redo command, but is
> so easy to use.

Oddly enough, that is one exception that I praise and the one difference
between nvi and vim that I cannot  live without. I use infinite undo via
'.'  all the  time,  but not  only  that,  I'm impressed  by  how I  can
``reverse'' the direction of the undo and '.' repeats that decision.

Andy
--
TAI64 timestamp: 400000005aac2904



--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Paul Vixie-2
rewind, please. i set VISUAL to /usr/local/bin/jove, and never have used
any version of vi with any version of mh, ever.

why would our build or install dependency list include any editor?

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Paul Fox-3
paul wrote:
 > rewind, please. i set VISUAL to /usr/local/bin/jove, and never have used
 > any version of vi with any version of mh, ever.

that was a simple case of mistaken identity.

paul

 >
 > why would our build or install dependency list include any editor?
 >
 > --
 > nmh-workers
 > https://lists.nongnu.org/mailman/listinfo/nmh-workers
 >


=----------------------
paul fox, [hidden email] (arlington, ma)


--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Bakul Shah
In reply to this post by Andy Bradford-2
On 16 Mar 2018 14:28:15 -0600 "Andy Bradford" <[hidden email]> wrote:
Andy Bradford writes:

> Thus said Paul Fox on Wed, 14 Mar 2018 14:59:57 -0400:
>
> > The big exception  that I remember was his  implementation of infinite
> > undo using '.', which broke a corner  case of the redo command, but is
> > so easy to use.
>
> Oddly enough, that is one exception that I praise and the one difference
> between nvi and vim that I cannot  live without. I use infinite undo via
> '.'  all the  time,  but not  only  that,  I'm impressed  by  how I  can
> ``reverse'' the direction of the undo and '.' repeats that decision.

Early in Vim's life I had emailed Moolenaar to suggest that
vim emulate nvi's behavior for the '.' command, at least as an
option.  He declined to do so and I continued using nvi.
Rapidly switching undo/redo direction in vim with e.g.
uuu^R^R^Ruu^R^R is much harder on my left thumb (& brain) than
vi's u..u..u.u. May be because reversing direction == u turn!

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Ralph Corderoy
In reply to this post by Paul Vixie-2
Hi Paul,

> i set VISUAL to /usr/local/bin/jove,

Don't forget this is a public mailing list.

> why would our build or install dependency list include any editor?

Fedora's is changing from an install dependency on /usr/bin/vi to a
Suggests one.  I haven't checked what the other distributions do.  AIUI
the idea is a user won't see

    $ comp
    unable to exec vi: No such file or directory
    whatnow: problems with edit--draft left in /home/ralph/mail/draft
    $

but instead they'll find themselves with a draft on the screen and lots
of beeping when they try to do anything.  Including getting out of `this
damn nmh' thing back to the shell.  :-)  If they don't have vi already
installed, they may not know how to use it.

The background: get_default_editor() is called for `edit' at the
whatnow(1) prompt, and to set the miscased `mheditor' in the environment
of a `whatnowproc' so it knows what to use.  It's the value of `editor'
if it's set in the context, else $VISUAL if set, else $EDITOR if set,
else `vi'.  `vi' as the fallback because it's POSIX.  But then so's
ed(1).  At least ed responds more visually than audibly.

I'd prefer that if they don't have vi installed then they don't gain it.
Perhaps the `problems with edit' message can benefit from knowing the
exec of the editor failed and point the user at the right bit of a man
page.

--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

David Levine-3
Ralph wrote:

> I'd prefer that if they don't have vi installed then they don't gain it.

Fedora's slogans include "Less setup".  So I can see it wanting to avoid your
comp fail scenario.

If we want to do anything, nmh could add support to install-mh to ask the user
what editor what they want to use, and put the result in their new profile.

David

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Paul Vixie-2
In reply to this post by Ralph Corderoy


Ralph Corderoy wrote:

>> why would our build or install dependency list include any editor?
>
> Fedora's is changing from an install dependency on /usr/bin/vi to a
> Suggests one.  I haven't checked what the other distributions do.  AIUI
> the idea is a user won't see
>
>      $ comp
>      unable to exec vi: No such file or directory
>      whatnow: problems with edit--draft left in /home/ralph/mail/draft
>      $

i have not run comp without first setting VISUAL for at least two
decades, but when i used to do this, it would print a message like "type
your message below, and then hit control-D" and then read from standard
input. when did that change to requiring an external editor? perhaps
that's where it all went wrong.

--
P Vixie


--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Andy Bradford-2
Thus said Paul Vixie on Sat, 17 Mar 2018 08:55:41 -0700:

> i have  not run  comp without  first setting VISUAL  for at  least two
> decades, but  when i used  to do this, it  would print a  message like
> "type your message  below, and then hit control-D" and  then read from
> standard input. when did that change to requiring an external editor?

I generally don't set VISUAL or EDITOR unless I absolutely have to (e.g.
on Ubuntu  which defaults to  nano) as I generally  expect vi to  be the
default.

$ set | grep -E '(EDITOR|VISUAL)'
$ echo $?
1

Andy
--
TAI64 timestamp: 400000005aad45d8



--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Ralph Corderoy
Hi Andy,

> I generally don't set VISUAL or EDITOR unless I absolutely have to
> (e.g. on Ubuntu which defaults to nano)

That reminds me: Debian, and Ubuntu, have /usr/bin/editor and
sensible-editor(1) that programs can fall back on.  What that is can be
set system-wide, or per user.
https://manned.org/sensible-editor.1
https://manned.org/select-editor.1
https://www.debian.org/doc/debian-policy/#editors-and-pagers

--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

David Levine-3
Ralph wrote:

> That reminds me: Debian, and Ubuntu, have /usr/bin/editor and

Fedora doesn't.

> sensible-editor(1) that programs can fall back on.

That Debian package is available (sensible-utils) on Fedora.  If a suitable
editor can't be found via VISUAL, EDITOR, etc., it falls back to nano.

It breaks when run under env -i.

David

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Ken Hornstein-2
In reply to this post by Paul Vixie-2
>i have not run comp without first setting VISUAL for at least two
>decades, but when i used to do this, it would print a message like "type
>your message below, and then hit control-D" and then read from standard
>input. when did that change to requiring an external editor? perhaps
>that's where it all went wrong.

Since you asked ...

Supporting the EDITOR/VISUAL environment variables is actually a nmh
thing (and is actually a recent thing).  That was added by me in
2013.  Before that you had to configure it in your .mh_profile or via
configure/mhconfig

And I went back and looked at mh 6.8 and mh 5; they were the same way.
I could find no support for any kind of simple read-from-the-terminal
message input like you describe (I didn't feel like tracking down mh 4
or mh 3).  I seem to remember that the old mail/Mail/mailx had that
behavior, though ... is it possible you're conflating things?

Ah, okay, I went back and double-checked things ... it turns out the
default editor back in the day (if you didn't configure one with
mhconfig) was "prompter", which would give you a kind of very simple
message input interface (but not exactly like you describe).  When
did that change?  That's ... not super clear.  The default inside of
mhconfig.c has always been prompter, but somewhere between MH 5 and MH
6 the default configuration file had line added that sets the editor
to be /usr/bin/vi.  But a lot of the example site templates specify
prompter, so what you GOT seems to depend on how things were configured
by whomever set up your MH installation.  That suggests to me that maybe
the default editor (in absence of any environment variables) should be
prompter, actually

In nmh the fallback editor was always 'vi', from as far back as we
have revision history.

--Ken

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

David Levine-3
Ken wrote:

> That suggests to me that maybe
> the default editor (in absence of any environment variables) should be
> prompter, actually

My first reaction was negative, but after looking at the man page and giving
it a quick try, it might not be so bad.  Someone should volunteer to live with
it for a while, though :-)

David

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Paul Vixie-2
In reply to this post by Ken Hornstein-2


Ken Hornstein wrote:
> ... it turns out the default editor back in the day (if you didn't
> configure one with mhconfig) was "prompter", which would give you a
> kind of very simple message input interface (but not exactly like you
> describe).

prompter is what i was thinking of. repl and forw also used it. it was
great, because after i screwed something up and needed to get into an
editor, i could say ^D and something would ask "What now?" and i'd give
it some instruction that would _then_ start my visual editor of choice.

i say again: this was really, really nice. simplicity by default, and
then all the power you asked for.

> When did that change? That's ... not super clear. The default inside
> of mhconfig.c has always been prompter, but somewhere between MH 5
> and MH 6 the default configuration file had line added that sets the
> editor to be /usr/bin/vi. But a lot of the example site templates
> specify prompter, so what you GOT seems to depend on how things were
> configured by whomever set up your MH installation. That suggests to
> me that maybe the default editor (in absence of any environment
> variables) should be prompter, actually

i think it should still be prompter, so that we have no editor
assumption or dependency.

> In nmh the fallback editor was always 'vi', from as far back as we
> have revision history.

i probably felt this change only rarely, since by the time nmh came out,
i was using mh primarily from within emacs, not command line.

--
P Vixie


--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Ken Hornstein-2
>> ... it turns out the default editor back in the day (if you didn't
>> configure one with mhconfig) was "prompter", which would give you a
>> kind of very simple message input interface (but not exactly like you
>> describe).
>
>prompter is what i was thinking of. repl and forw also used it. it was
>great, because after i screwed something up and needed to get into an
>editor, i could say ^D and something would ask "What now?" and i'd give
>it some instruction that would _then_ start my visual editor of choice.

Yeah, I tried it quickly and it seems simple enough.  And people who have
editor in their profile or use EDITOR/VISUAL won't notice a change.

>> That suggests to
>> me that maybe the default editor (in absence of any environment
>> variables) should be prompter, actually
>
>i think it should still be prompter, so that we have no editor
>assumption or dependency.

That sounds reasonable to me.  Thoughts, objections?  David, I saw
your reply and it sounds like you'd be okay with that, unless I
misunderstood you.

--Ken

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

David Levine-3
Ken wrote:

> That sounds reasonable to me.  Thoughts, objections?  David, I saw
> your reply and it sounds like you'd be okay with that, unless I
> misunderstood you.

I'm fine with it.

David

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Paul Fox-3
In reply to this post by Ken Hornstein-2
ken wrote:
 > >prompter is what i was thinking of. repl and forw also used it. it was
 ...
 > Yeah, I tried it quickly and it seems simple enough.  And people who have
 > editor in their profile or use EDITOR/VISUAL won't notice a change.
 ...
 > >i think it should still be prompter, so that we have no editor
 > >assumption or dependency.

i'm good with prompter.  i didn't know it existed, and wrote my own
script to do much the same thing a couple of years ago, for use on my
phone.  bringing up vi on a phone's ssh connection is...  sub-optimal.

i don't think any of us involved in the vi-as-default thread from a
few years back really considered that it might cause a package dependency.

paul
=----------------------
paul fox, [hidden email] (arlington, ma, where it's 20.7 degrees)


--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Ken Hornstein-2
>i'm good with prompter.  i didn't know it existed, and wrote my own
>script to do much the same thing a couple of years ago, for use on my
>phone.  bringing up vi on a phone's ssh connection is...  sub-optimal.

Alright, done!

--Ken

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Ralph Corderoy
In reply to this post by David Levine-3
Hi David,

> > sensible-editor(1) that programs can fall back on.
>
> That Debian package is available (sensible-utils) on Fedora.  If a
> suitable editor can't be found via VISUAL, EDITOR, etc., it falls back
> to nano.

It tries

    $VISUAL
    . ~/.selected_editor
    # Maybe run select-editor.
    $EDITOR
    $SELECTED_EDITOR
    nano
    nano-tiny
    vi
    # Error: tell user to set $EDITOR.
   
select-editor is run if $EDITOR isn't set and stdin is a TTY.

> It breaks when run under env -i.

No PATH confuses which(1).  I expect no PATH confuses quite a few
things.  :-)

--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary dependency on vi???

Ralph Corderoy
In reply to this post by Ken Hornstein-2
Hi Ken,

> Paul Vixie wrote:
> > prompter is what i was thinking of.

Well remembered.  I've used that too a long time ago.
For quick short emails I prefer the imperative style of giving
recipients and subject on the command line rather than interactive of
being prompted as that's a bit slower.

> > i could say ^D and something would ask "What now?" and i'd give it
> > some instruction that would _then_ start my visual editor of choice.

Like `~e' or `~v' escapes, for ed(1) and vi(1) at the start of a line
when entering body in mail(1) to upgrade when editing is required.

> > i think it should still be prompter, so that we have no editor
> > assumption or dependency.
>
> That sounds reasonable to me.  Thoughts, objections?

+1.  It also matches

    Editing the Draft with prompter
    https://rand-mh.sourceforge.io/book/mh/senove.html#Edipro

--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
1234