emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Environment variables for remote processes


From: Michael Albinus
Subject: Re: Environment variables for remote processes
Date: Sun, 23 Nov 2014 11:22:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

andres.ramirez <address@hidden> writes:

> Hi guys this is  my case. I think it qualifies as as subprocess. I hope it 
> helps to clarify some ideas:

Hi Andres,

> * how I start emacs
> It is started from a crontab and using daemon:
> @reboot emacs --quick --daemon
> ** Notice: known condition emacs daemon issue with gtk (this gtk bug have 
> years )
> http://bugzilla.gnome.org/show_bug.cgi?id=85715

I guess you connect that daemonized Emacs via emacsclient.

> * What's the problem with emacs started before X?
>  no 'DBUS_SESSION_BUS_ADDRESS' and other variables.

For all missing environment variables, you must add them from your
client session to the daemonized Emacs via setenv. But I'm pretty sure
you know that already :-)

> ** enviroment variables from emacs started on cron job (very short)
> ** enviroment variables from emacs started after X
> * CONCLUSION: In this particular case. It should be possible to add the 
> necessary environment variables for notify-send to work.
> (dbus-init-bus my-dbus-address) is not enough

As said above, setenv will be your friend. This extends process-environment.

However, this is not sufficient for remote processes started via
Tramp. Here you have now (after the recent change) two options:

- Add the environment variable to tramp-remote-process-environment
  before opening a remote connection:

  (setq tramp-remote-process-environment
        (cons
          
"DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-uxYK2KP5AO,guid=bde80a1c96d99a424bfa48eb546cacf2"
          tramp-remote-process-environment))

  This environment variable will exist permanently on the remote side
  while running Tramp.

- Let-bind the environment variable to process-environment before
  calling process-file or start-file-process:

  (let ((process-environment
          (cons 
"DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-uxYK2KP5AO,guid=bde80a1c96d99a424bfa48eb546cacf2"
                process-environment)))
     (process-file ...))

  This environment variable will exist just for the process started on
  the remote side.
  
> Best Regards

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]