From 2655155da480004b4bcb33e277d3ca68dd16c3f2 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Thu, 20 May 2021 18:40:57 +0800 Subject: Refactor WIFI list command. * wifi-bluetooth-conf.el (durand-wifi-list-ports): The default behaviour should only list the currently connected WIFI port, instead of listing every available port. (durand-wifi-list-sentinel): The sentinel should report if WIFI is not enabled. --- wifi-bluetooth-conf.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'wifi-bluetooth-conf.el') diff --git a/wifi-bluetooth-conf.el b/wifi-bluetooth-conf.el index d02bb77..a32af96 100644 --- a/wifi-bluetooth-conf.el +++ b/wifi-bluetooth-conf.el @@ -139,13 +139,13 @@ If ARG is non-nil, then list the currently connected port." (make-process :name "durand-wifi-list-ports" :buffer durand-wifi-bluetooth-buffer - :command (list durand-wifi-executable "-s") + :command (list durand-wifi-executable "-I") :sentinel #'durand-wifi-list-sentinel)) ((make-process :name "durand-wifi-list-ports" :buffer durand-wifi-bluetooth-buffer - :command (list durand-wifi-executable "-I") - :sentinel #'durand-wifi-list-sentinel)))) + :command (list durand-wifi-executable "-s") + :sentinel #'durand-wifi-list-sentinel) ))) ;;;###autoload (defun durand-wifi-join-port (port &optional pwd) @@ -179,7 +179,9 @@ This only does something when STATUS is the string \"finished\\n\"." (cond ((string-equal status "finished\n") (with-current-buffer durand-wifi-bluetooth-buffer (goto-char (point-min)) - (cond ((re-search-forward "\\s-+SSID" (line-end-position) t) + (cond ((re-search-forward "AirPort: Off" nil t) + (message "Wifi is not enabled.")) + ((re-search-forward "\\s-+SSID" (line-end-position) t) (setq first-var t) (forward-line 1) (let ((start 0) list-of-ssids) -- cgit v1.2.3-18-g5258