`port edit`, local/console vs. remote use

Rainer Müller raimue at macports.org
Tue Dec 6 16:32:27 CET 2016


On 2016-12-06 17:03, René J.V. Bertin wrote:
> Has there ever been discussion about if and how to let `port edit`
> invoke a different editor when you're working locally vs. over SSH?

'port edit' just invokes the common VISUAL or EDITOR from your
environment, so you will experience the same thing with other tools.

> I realise this could theoretically be handled by setting a different
> MP_EDITOR value in your shell's .*profile/.*rc file but I cannot
> think of a reliable way to detect local vs. remote access right now,
> esp. not one that will distinguish between local "aqua vs non aqua"
> sessions. And to make things yet more complex: ssh to a remote host
> and from there back to a Mac, all from within an Aqua session, and
> you can still do things like `open -e` to edit a file in TextEdit.

Check for SSH_CONNECTION in the environment in your shell rc files and
export a different VISUAL and/or EDITOR accordingly.

There is no easy way to detect such a loop. Maybe you could check
whether you have another graphical session... but even then, how would
it know whether you are sitting in front of the Mac right now? I would
avoid such a setup.

Rainer


More information about the macports-dev mailing list