3

In linux, the desktop environment stores the proxy settings. These proxy settings are then picked up by applications running for that instance of the desktop environment for a particular user. Your browsers. terminal etc, pick up these settings.

In case of the GNOME terminal, it sets the HTTP_PROXY and HTTPS_PROXY variable while starting the shell. The values for these variables are set by terminal when it starts up and are valid for the duration of the shell.

Can we do something similarly in emacs other than setting up the proxy using the set_proxy function in our init file? Can we set up a generic function that will pick up these settings from the desktop environment?

Starting emacs from the terminal and it picking up the proxy variables from the terminal environment is not the answer what I am looking for. I am specifically trying to find how emacs accesses Desktop Environment settings.

Tyler
  • 21,719
  • 1
  • 52
  • 92
ksinkar
  • 526
  • 5
  • 9

1 Answers1

1

As per M.W.'s Answer to a Similar Question,

Emacs populates the url-proxy-services variable from the http_proxy, https_proxy and no_proxy environment variables if they are set.

You can then start your emacsclient from you GNOME terminal, just make sure that all variants (lowercase and capitalized) of the proxy variables are exported in your ~/.bashrc, or ~/.zshrc, or ~/.profile.

In this case your emacs session will obviously be bound to the instance of your GNOME terminal.

nyameko
  • 545
  • 2
  • 15
  • I would like emacs to pick up the `http` and `http_proxy` variables from the Desktop Environment. Although your solution does reveal that if emacs is started as daemon, then it shall pick up the proxy settings if they were available at that time. I am trying to make Emacs behave like any other GNOME app, such that it reflects the proxy setting of the Desktop Environment at that point in time. Starting emacs from the terminal is not an option here. – ksinkar Jan 30 '17 at 05:38