Skip to content

Instantly share code, notes, and snippets.

@purcell
Created October 24, 2013 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save purcell/7137866 to your computer and use it in GitHub Desktop.
Save purcell/7137866 to your computer and use it in GitHub Desktop.
proxy-mode.el
;;; proxy-mode.el --- Provides proxy minor mode.
;; Copyright (C) 2013 by Sachin Patil
;; Author: Sachin Patil <isachin@iitb.ac.in>
;; URL: http://github.com/psachin/proxy-mode
;; Keywords: network, proxy, tool, convenience
;; Version: 0.9
;; This file is NOT a part of GNU Emacs.
;; `proxy-mode' is free software distributed under the terms of
;; the GNU General Public License, version 3. For details, see the
;; file COPYING.
;;; Commentary:
;; Provides proxy minor mode.
;; URL: http://github.com/psachin/proxy-mode
;; Install
;; Using `package'
;; M-x package-install proxy-mode
;; Unless installed from a `package', add the directory containing
;; this file to `load-path', and then:
;; (require 'proxy-mode)
;;
;; To enable this mode globally:
;;
;; '(proxy-mode t)
;; Customize
;; M-x customize-group RET proxy-mode RET
;;
;; See ReadMe.org for more info.
;;; Code:
(require 'url)
(defgroup proxy-mode nil
"Provides proxy minor mode."
:group 'extensions
:link '(url-link :tag "Github" "https://github.com/psachin/proxy-mode"))
(defun proxy-enable ()
"Enable proxy."
(kill-local-variable 'url-proxy-services))
(defun proxy-disable ()
"Disable proxy."
(set (make-local-variable 'url-proxy-services) nil))
;;;###autoload
(define-minor-mode proxy-mode
"Minor proxy-mode."
:lighter nil ;; " ρ"
:global t
:group 'proxy
(if (not proxy-mode)
(proxy-disable)
(proxy-enable)))
(provide 'proxy-mode)
;;; proxy-mode.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment