是否可以告诉emacs在Windows上使用IE http代理设置? [英] Is it possible to tell emacs on Windows to use the IE http proxy settings?
问题描述
是否可以自动告诉emacs 使用IE使用的任何代理设置?
url.el包可以显式指定一个代理如下:
(setq url-using-proxy t)
(setq url-proxy-services'((http。proxyserver:3128)))
当我更改IE代理设置时,是否有可能发生自动神奇的事情?
是的,这是可能的。
基本思想是为URL函数定义before-advice,并将这些变量设置为适当的值。这需要从elisp中从Windows中检索IE代理设置。
w32注册表包执行此操作。
因此,在Windows上,您可以执行以下操作:
eval-after-loadurl
'(progn
(require'w32-registry)
(defadvice url-retrieve(before
w32-set-proxy-dynamic
$ b在检索URL之前,查询IE代理设置,并使用它们。
(let((proxy(w32reg-get-ie-proxy-config)))
(setq url-using-proxy proxy
url-proxy-services proxy)))))
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?
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)))))
这篇关于是否可以告诉emacs在Windows上使用IE http代理设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!