【问题标题】:Is it possible to tell emacs on Windows to use the IE http proxy settings?是否可以告诉 Windows 上的 emacs 使用 IE http 代理设置?
【发布时间】:2012-04-20 11:12:36
【问题描述】:

另请参阅:Emacs behind HTTP proxy

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

url.el 包说我可以像这样显式指定一个代理:

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

当我更改 IE 代理设置时,这可能会自动发生吗?

【问题讨论】:

    标签: emacs elisp http-proxy


    【解决方案1】:

    是的,这是可能的。

    基本思想是为 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)))))
    

    【讨论】:

      【解决方案2】:

      如果您通过浏览 URL 处理 URL,您也可以像这样将其设置为 Windows 特定功能。然后 URL 将由 Windows 处理(调用您的默认浏览器)。

      browse-url-browser-function 是 `browse-url.el' 中定义的变量。

      它的值是browse-url-default-windows-browser

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-23
        • 1970-01-01
        • 2011-04-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多