Re: about EDITOR_LINENUMBER_SWITCH - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: about EDITOR_LINENUMBER_SWITCH
Date
Msg-id 1306269412.14693.7.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: about EDITOR_LINENUMBER_SWITCH  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: about EDITOR_LINENUMBER_SWITCH  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On lör, 2011-05-21 at 20:39 -0400, Robert Haas wrote:
> On Sat, May 21, 2011 at 5:47 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> > I noticed the 9.1 release notes claim that the new
> > EDITOR_LINENUMBER_SWITCH thing is an environment variable, whereas it is
> > actually a psql variable.

> It's probably the result of drift between the original patch and what
> was eventually committed.  IIRC, Pavel had it as an environment
> variable originally, but Tom and I didn't feel the feature was
> important enough to merit that treatment.

I think it's not really a matter of "importance", it's a matter of
making things work correctly.  I have a shell configuration that sets
different environment variables, including editor, depending on what
directory I'm in.  Now I think that all the editors in question use the
+ syntax, but anyone else with something like that slightly out of the
ordinary would be stuck.  The other problem is if I change the editor
here, I have to change this other piece there.  Note that you cannot
even specify the editor itself in psqlrc.

> > Another thought is that this whole thing could be done away with if we
> > just allowed people to pass through arbitrary options to the editor,
> > like
> >
> > \edit file.sql +50 -a -b -c
> >
> > For powerusers, this could have interesting possibilities.
> 
> That's an intriguing possibility.  But part of the point of the
> original feature was to be able to say:
> 
> \ef somefunc 10
> 
> ...and end up on line 10 of somefunc, perhaps in response to an error
> message complaining about that line.  I don't think your proposal
> would address that.

Well, you'd write

\ef somefunc +10

instead.  Or something else, depending on the editor, but then you'd
know what to write, since under the current theory you'd have to have
configured it previously.  Using the "+10" syntax also looks a bit
clearer, in my mind.





pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: tackling full page writes
Next
From: Peter Eisentraut
Date:
Subject: Re: about EDITOR_LINENUMBER_SWITCH