Re: [dev] announcing edit-pipe

From: Thomas Levine <>
Date: Sun, 27 Aug 2017 20:36:44 +0000

> > * mktemp is not portable; you could use something like the date and
> > process identifier ($$) to create a portable temporary file.
> > (I am actually still curious as to whether there is a reasonable
> > portable approach that is less sloppy than this.)
> I'm not sure the best way to do that or if it's worth the extra
> complication. It is unfortunate that POSIX doesn't have mktemp or a
> command to do the same thing. However, mktemp seems to be very widely
> available. It is in GNU coreutils (i.e. Gnu/Linux), OpenBSD, NetBSD,
> FreeBSD, Mac OS X, HP-UX, Tru64 Unix.

While mktemp is very widely available, I came across systems where it
was not, and I came across others where it behaved incompatibly.
I think HP-UX was one of the problematic operating systems. I may have
made notes on this in the urchin issue tracker and commit history,
but I don't remember.

> > * Quote "$edit" in case the editor has a space in its name.
> I deliberately do not quote $edit so that I can set EDITOR to nano -w.
> Is that non-standard/wacky? Is there a convention for whether the the
> value of EDITOR environment variable should be able to have options?

Dunno about the convention. Please report if you come up with an answer,
as I am curious. Here are some ideas of how to handle this. They're in
decreasing order of my preference, but the first one is the only one that
I think is good.

* Quote the variable, set EDITOR equal to "nano-w", and implement "nano-w"
  as a program that calls "nano -w".
* Handle EDITOR and VISUAL one way, and handle two alternative
  non-standard variables the other way.
* Call "eval $EDITOR", so that it is at least possible to specify paths
  with spaces by quoting the path.
* Add a flag that affects how spaces are handled.

> > * You haven't handled editor errors.
> I'm not sure the best way to do that or if it's worth the extra
> complication.

I present one approach in the attachment.
It is based on commit 08d2db088dad2f35ce91523eb35b6456dd189031.

Received on Sun Aug 27 2017 - 22:36:44 CEST

This archive was generated by hypermail 2.3.0 : Sun Aug 27 2017 - 22:48:19 CEST