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

前端 未结 2 1620
南方客
南方客 2021-02-04 12:04

See also: Emacs behind HTTP proxy

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

2条回答
  •  盖世英雄少女心
    2021-02-04 12:33

    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)))))
    

提交回复
热议问题