diff options
author | Yuchen Pei <hi@ypei.me> | 2022-10-11 11:31:26 +1100 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-10-11 11:31:26 +1100 |
commit | 7652f876d00152e127a93767581bfedde6be61ce (patch) | |
tree | 7753ab90a6a3e0fd3aec8e3b074b155cae4c2239 | |
parent | 3c337adc87d9ba6b8cb81e04136c73040982fdfb (diff) |
display tor status
-rw-r--r-- | luwak.el | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -29,7 +29,14 @@ "Function to rewrite url before loading." :group 'luwak :type '(function)) -(define-derived-mode luwak-mode special-mode "luwak" +(defun luwak-mode-name () + (concat "luwak " + (cond + ((null luwak-data) "Tor unknown") + ((plist-get luwak-data :no-tor) "Tor off") + (t "Tor on")))) + +(define-derived-mode luwak-mode special-mode (luwak-mode-name) "Major mode for browsing the web using lynx -dump.") (defvar luwak-mode-map @@ -64,7 +71,7 @@ (message "Loading %s..." url) (set-process-sentinel (luwak-start-process-with-torsocks - current-prefix-arg + no-tor "luwak-lynx" (luwak-lynx-buffer url) "lynx" "-dump" "--display_charset" "utf-8" url) (lambda (process _) @@ -78,8 +85,11 @@ (luwak-render-links (luwak-get-links))) (unless (derived-mode-p 'luwak-mode) (luwak-mode)) (if luwak-data - (plist-put luwak-data :url url) + (progn + (plist-put luwak-data :url url) + (plist-put luwak-data :no-tor no-tor)) (setq luwak-data (list :url url :no-tor no-tor :history-pos 0))) + (setq mode-name (luwak-mode-name)) (when cb (funcall cb))) (display-buffer luwak-buffer)))) |