all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Accessing emacsclient environment variables.
@ 2014-07-06 18:39 Abutalib Aghayev
  2014-07-06 23:21 ` Suvayu Ali
  2014-07-07  1:01 ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Abutalib Aghayev @ 2014-07-06 18:39 UTC (permalink / raw)
  To: help-gnu-emacs


Hi all,

On machine "foo", I start emacs as a server using "emacs --daemon" and
on machine "bar" I do remote editing by running "ssh -A foo emacsclient
-c".  The -A switch is to enable SSH Agent Forwarding.

Now, when I run shell in emacsclient (M-x shell), the shell does not
have SSH_AUTH_SOCKET properly set, which is normal, since emacs server
was started locally and M-x shell uses server's environment to launch a
shell.

However, emacsclient has the correct SSH_AUTH_SOCKET value in its
environment -- I can verify that by running "cat
/proc/pid-of-emacs-client/environ".

Is there a way of accessing emacsclient's environment variable or at
least its process id, so that I could set SSH_AUTH_SOCKET before
launching shell?  Better yet, is there a simpler way to solve this
problem?

Thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Accessing emacsclient environment variables.
  2014-07-06 18:39 Accessing emacsclient environment variables Abutalib Aghayev
@ 2014-07-06 23:21 ` Suvayu Ali
  2014-07-07 23:19   ` Abutalib Aghayev
  2014-07-07  1:01 ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Suvayu Ali @ 2014-07-06 23:21 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, Jul 06, 2014 at 02:39:36PM -0400, Abutalib Aghayev wrote:
> launching shell?  Better yet, is there a simpler way to solve this
> problem?

I would try to run emacsclient on the local machine and connect to the
emacs server over tramp.  See "How can I use TRAMP to connect to a
remote Emacs session?" in the tramp FAQ.  Note this requires the machine
running emacs server can resolve the address you are connecting from.
So if you are behind NAT or something similar, it will fail.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Accessing emacsclient environment variables.
  2014-07-06 18:39 Accessing emacsclient environment variables Abutalib Aghayev
  2014-07-06 23:21 ` Suvayu Ali
@ 2014-07-07  1:01 ` Stefan Monnier
  2014-07-07 23:19   ` Abutalib Aghayev
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2014-07-07  1:01 UTC (permalink / raw)
  To: help-gnu-emacs

> Is there a way of accessing emacsclient's environment variable or at
> least its process id, so that I could set SSH_AUTH_SOCKET before
> launching shell?

Yes, you can use (frame-parameter nil 'environment) to get
the environment.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Accessing emacsclient environment variables.
  2014-07-07  1:01 ` Stefan Monnier
@ 2014-07-07 23:19   ` Abutalib Aghayev
  0 siblings, 0 replies; 6+ messages in thread
From: Abutalib Aghayev @ 2014-07-07 23:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs


On Sun, Jul 06 2014 at 21:01 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> Is there a way of accessing emacsclient's environment variable or at
>> least its process id, so that I could set SSH_AUTH_SOCKET before
>> launching shell?
>
> Yes, you can use (frame-parameter nil 'environment) to get
> the environment.

Thanks, exactly what I was looking for!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Accessing emacsclient environment variables.
  2014-07-06 23:21 ` Suvayu Ali
@ 2014-07-07 23:19   ` Abutalib Aghayev
  2014-07-08 12:31     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Abutalib Aghayev @ 2014-07-07 23:19 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: help-gnu-emacs


On Sun, Jul 06 2014 at 19:21 PM, Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
> On Sun, Jul 06, 2014 at 02:39:36PM -0400, Abutalib Aghayev wrote:
>> launching shell?  Better yet, is there a simpler way to solve this
>> problem?
>
> I would try to run emacsclient on the local machine and connect to the
> emacs server over tramp.  See "How can I use TRAMP to connect to a
> remote Emacs session?" in the tramp FAQ.  Note this requires the machine
> running emacs server can resolve the address you are connecting from.
> So if you are behind NAT or something similar, it will fail.

I'm aware of TRAMP but I'm behind NAT, thanks for the suggestion though.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Accessing emacsclient environment variables.
  2014-07-07 23:19   ` Abutalib Aghayev
@ 2014-07-08 12:31     ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-07-08 12:31 UTC (permalink / raw)
  To: help-gnu-emacs

> I'm aware of TRAMP but I'm behind NAT, thanks for the suggestion though.

BTW, I find that to access machines which are behind NATs, OpenVPN is
a wonderful tool.  Of course, it requires access to a "always ON and not
behind NAT" machine.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-08 12:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-06 18:39 Accessing emacsclient environment variables Abutalib Aghayev
2014-07-06 23:21 ` Suvayu Ali
2014-07-07 23:19   ` Abutalib Aghayev
2014-07-08 12:31     ` Stefan Monnier
2014-07-07  1:01 ` Stefan Monnier
2014-07-07 23:19   ` Abutalib Aghayev

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.