summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wifi-bluetooth-conf.el25
1 files changed, 19 insertions, 6 deletions
diff --git a/wifi-bluetooth-conf.el b/wifi-bluetooth-conf.el
index 52bff4d..588024d 100644
--- a/wifi-bluetooth-conf.el
+++ b/wifi-bluetooth-conf.el
@@ -151,16 +151,28 @@ If ARG is non-nil, then list the currently connected port."
(defvar durand-wifi-ssid-machine-alist
(list
(cons "20-1" "wifi-2")
- (cons "1-20-4F" "wifi-4"))
+ (cons "1-20-4F" "wifi-4")
+ (cons "1-20-4F_2EX" "wifi-4"))
"A list of associations between the SSID of WIFI and the
machine name that we can use to search for the password in my
secret file.")
;;;###autoload
+(defvar durand-wifi-scanned-ssids nil
+ "The variable that holds the list of SSIDs of WIFI ports found
+ during the scan.")
+
+;;;###autoload
+(defvar durand-wifi-join-history nil
+ "The variable that holds the history of WIFI ports joined.")
+
+;;;###autoload
(defun durand-wifi-join-port (port &optional pwd)
"Join PORT.
If PWD is non-nil, use that as the password."
- (interactive (let ((po (read-string "Port to join: "))
+ (interactive (let ((po (completing-read
+ "Port to join: " durand-wifi-scanned-ssids
+ nil nil nil 'durand-wifi-join-history))
(pwd (read-string "Password: ")))
(cond ((and pwd (not (string= pwd "")))
(list po pwd))
@@ -200,6 +212,7 @@ This only does something when STATUS is the string \"finished\\n\"."
process)))
(let (first-var)
(cond ((string-equal status "finished\n")
+ (setq durand-wifi-scanned-ssids nil)
(with-current-buffer durand-wifi-bluetooth-buffer
(goto-char (point-min))
(cond ((re-search-forward "AirPort: Off" nil t)
@@ -207,20 +220,20 @@ This only does something when STATUS is the string \"finished\\n\"."
((re-search-forward "\\s-+SSID" (line-end-position) t)
(setq first-var t)
(forward-line 1)
- (let ((start 0) list-of-ssids)
+ (let ((start 0))
(while (re-search-forward "\\S-" (line-end-position) t)
(forward-char -1)
(setq start (point))
(re-search-forward "\\s-" (line-end-position) t)
(forward-char -1)
- (setq list-of-ssids
+ (setq durand-wifi-scanned-ssids
(cons (buffer-substring-no-properties
start (point))
- list-of-ssids))
+ durand-wifi-scanned-ssids))
(forward-line 1))
(erase-buffer)
(goto-char (point-min))
- (insert (string-join list-of-ssids (string 10)))
+ (insert (string-join durand-wifi-scanned-ssids (string 10)))
(goto-char (point-min))))
((re-search-forward "\\s-+SSID: " nil t)
(message (buffer-substring-no-properties