emacs - 是否可以告诉 Windows 上的 emacs 使用 IE http 代理设置?

标签 emacs elisp http-proxy

See also: Emacs behind HTTP proxy



是否可以告诉 emacs 自动使用 IE 正在使用的任何代理设置?

url.el 包说我可以像这样明确指定一个代理:
(setq url-using-proxy t)
(setq url-proxy-services  '(("http" . "proxyserver:3128")))

当我更改 IE 代理设置时,这是否有可能自动发生?

最佳答案

是的,这是可能的。

基本思想是为 URL 函数定义 before-advice,并将这些变量设置为适当的值。这需要能够从 elisp 中从 Windows 检索 IE 代理设置。

w32-registry package这样做。

因此,在 Windows 上,您可以这样做:

(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 上的 emacs 使用 IE http 代理设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10050186/

相关文章:

java - 对选定的 jaxws 请求使用 httpsproxy,而不是在系统中设置它

Emacs:如何在框架栏中显示当前目录?

emacs - 在 Emacs 中禁用鼠标滚动

emacs - emacs lisp shell 进程参数的问题

emacs - 如何在正则表达式、Emacs/elisp 风格中用 "("替换 "\("?

javascript - 通过 http-proxy-middleware 实现零响应

emacs - 如何强制emacs重新着色

emacs - 将 Base64 解码为 UTF-8,而不是单字节编码文本

emacs - 获取不带扩展名的文件的绝对路径

proxy - http_proxy 和 https_proxy 的区别