Is it possible to tell emacs on Windows to use the IE http proxy settings?
Asked Answered
B

2

12

See also: Emacs behind HTTP proxy

Is it possible to tell emacs to automatically use whatever proxy settings are in use by IE?

The url.el package says I can explicitly specify a proxy like this:

(setq url-using-proxy t)
(setq url-proxy-services  '(("http" . "proxyserver:3128")))

Is it possible for this to happen sort of auto-magically, when I change the IE proxy settings?

Bravo answered 6/4, 2012 at 23:0 Comment(0)
B
16

Yes, it's possible.

The basic idea is to define before-advice for the URL functions, and set those variables to appropriate values. This requires being able to retrieve the IE proxy settings from Windows, from within elisp.

The w32-registry package does this.

Therefore, on Windows, you can do this:

(eval-after-load "url"
  '(progn
     (require 'w32-registry)
     (defadvice url-retrieve (before
                              w32-set-proxy-dynamically
                              activate)
       "Before retrieving a URL, query the IE Proxy settings, and use them."
       (let ((proxy (w32reg-get-ie-proxy-config)))
         (setq url-using-proxy proxy
               url-proxy-services proxy)))))
Bravo answered 6/4, 2012 at 23:3 Comment(0)
P
0

If you are handling URL's via browse-url, you can also set it to Windows-specific function like this. Then the URL's will be handled by Windows (invoking your default browser).

browse-url-browser-function is a variable defined in `browse-url.el'.

Its value is browse-url-default-windows-browser

Plasia answered 9/4, 2012 at 21:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.