Meadowで東工大のプロキシを突破するELisp
Meadowの入ったノートパソコンをもって大学に通っている人に必須のスクリプト。学内で文章を保存した際にOutputzが作動してタイムアウトまで待たされてムキーとなる現象が改善されます。
以下を.emacs内に記述すればOK
;; Titech portal Proxy setting (defun titech-proxy-enable () (interactive) (setenv "HTTP_PROXY" "http://131.112.125.90:3128/") (setq http-proxy-server "131.112.125.90" http-proxy-port "3128" url-proxy-services '(("http" . "131.112.125.90:3128") ("https" . "131.112.125.90:3128"))) (message "Titech Proxy Enabled")) (defun titech-proxy-disable () (interactive) (setenv "HTTP_PROXY" nil) (setq http-proxy-server nil http-proxy-port nil url-proxy-services nil) (message "Titech Proxy Disabled")) (defun titech-proxy-auto-setting () (interactive) (with-temp-buffer (call-process "ipconfig" nil t) (goto-char (point-min)) (if (search-forward "pubnet.titech.ac.jp" nil t) (titech-proxy-enable) (titech-proxy-disable)))) (titech-proxy-auto-setting)
Meadow起動時に東工大内のネットワークに接続しているかを判断して自動的にプロキシの設定をしてくれます。その他「M-x titech-proxy-**」系のコマンドを3つほど登録します。
PCが接続しているネットワークを判別するためにipconfigを使っているのでWindows専用です。