[elpa] master eb6b085 11/76: Fixed up copyright information.

2017-02-23 Thread Ian Dunn
branch: master
commit eb6b0856db17707cf182173c85ddae28a7646371
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

Fixed up copyright information.
(enwc-format-mode-line-string): Set up to handle invalid and connecting 
networks.
---
 lisp/enwc-cm.el|  4 +--
 lisp/enwc-nm.el|  3 +-
 lisp/enwc-setup.el | 13 ++---
 lisp/enwc-wicd.el  |  2 +-
 lisp/enwc.el   | 84 +-
 5 files changed, 50 insertions(+), 56 deletions(-)

diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
index 975c9f9..21faba6 100644
--- a/lisp/enwc-cm.el
+++ b/lisp/enwc-cm.el
@@ -1,6 +1,6 @@
 ;; enwc-cm.el
 
-;; Copyright (C) 2012,2013 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -31,7 +31,6 @@
 ;; check-connecting
 ;; get-current-nw-id
 
-
 (require 'enwc)
 
 (defgroup enwc-cm nil
@@ -44,7 +43,6 @@
   :group 'enwc-cm
   :type 'string)
 
-
 ;; DEMAND TO SEE LIFE'S MANAGER!!
 
 (defcustom enwc-cm-dbus-manager-interface "net.connman.Manager"
diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 6e4e694..20b3d16 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -1,6 +1,6 @@
 ;;; enwc-nm.el - The NetworkManager backend to ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -257,7 +257,6 @@ This returns a list of D-Bus paths to the access points."
enwc-nm-dbus-service
enwc-nm-wireless-dev
enwc-nm-dbus-wireless-interface
-
"GetAccessPoints"))
 
 ;; Accesspoint
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index ec6bf9d..2dc9f16 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -1,6 +1,6 @@
 ;; enwc-setup.el - Setup routines for ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -97,16 +97,7 @@
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
   (if enwc-display-mode-line
-  (enwc-enable-display-mode-line)
-  ;; (progn
-  ;;   (unless (member 'enwc-display-string
-  ;;   global-mode-string)
-  ;; (setq global-mode-string (append global-mode-string
-  ;;  '(enwc-display-string
-  ;;   (setq enwc-display-mode-line-timer 
-  ;; (run-at-time t 1 'enwc-update-mode-line)))
-)
-  
+  (enwc-enable-display-mode-line))
 
   (if (and enwc-auto-scan (> enwc-auto-scan-interval 0))
   (setq enwc-scan-timer
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index f02f4b6..b6db670 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -1,6 +1,6 @@
 ;;; enwc-wicd.el --- The Wicd backend to ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 6097957..872e70a 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -1,6 +1,6 @@
 ;;; enwc.el --- The Emacs Network Client
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -447,47 +447,49 @@ WIRED indicates whether or not this is a wired 
connection."
   "Formats the mode line string.
 This is derived from `enwc-mode-line-format'.
 See the documentation for it for more details."
-  (if (enwc-check-connecting-p)
-  "[*]"
-(let* ((f enwc-mode-line-format)
-   (p 0)
-   (l (length f))
-   (cur-id (enwc-get-current-nw-id))
-   c fin-str)
-  (while (< p l)
-(setq c (elt f p))
-(setq p (1+ p))
-(setq fin-str
-  (concat
-   fin-str
-   (if (not (eq c ?%))
-   (char-to-string c)
- (setq p (1+ p))
+  (let* ((f enwc-mode-line-format)
+ (p 0)
+ (l (length f))
+ (cur-id (enwc-get-current-nw-id))
+ c fin-str)
+(while (< p l)
+  (setq c (elt f p))
+  (setq p (1+ p))
+  (setq fin-str
+(concat
+ fin-str
+ (if (not (eq c ?%))
+ (char-to-string c)
+   (setq p (1+ p))
+   (cond
+((eq (elt f (1- p)) ?s)
  (cond
-  ((eq (elt f (1- p)) ?s)
-   (if (enwc-is-wired-p)
-   "100"
- (number-to-string
-  (cdr (asso

[elpa] master ca50c21 21/76: (enwc--int-to-byte-list, enwc--byte-list-to-int, enwc--htonl): Added to assist with D-Bus conversion.

2017-02-23 Thread Ian Dunn
branch: master
commit ca50c2110b6ad647a9e234e0d52412cfc8b48540
Author: Ian D 
Commit: Ian D 

(enwc--int-to-byte-list, enwc--byte-list-to-int, enwc--htonl): Added to 
assist with D-Bus conversion.
(enwc-nm-sec-types): Removed.
(enwc-nm-dbus-*-call-method): Used `apply' to pass the argumetnts to 
`enwc-nm-dbus-call-method'.
(enwc-nm-gen-uuid): Added doc-string.
(enwc-nm-convert-addr): Added doc-string.
(enwc-nm-addr-back): Fixed bugs and added doc-string.
(enwc-nm-netmask-to-prefix): Added doc-string.
(enwc-nm-prefix-to-netmask): Fixed bugs and added doc-string.
(enwc-nm-set-dbus-dict-entry): Added correct return value.
(enwc-nm-get-profile-info): Implemented `enwc-nm-prefix-to-netmask'.
---
 lisp/enwc-nm.el | 101 ++--
 lisp/enwc.el|  17 ++
 2 files changed, 50 insertions(+), 68 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 8124a27..feff840 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -94,42 +94,6 @@
   '("Ssid" "HwAddress" "Strength" "Flags" "Mode" "Frequency")
   "The list of the desired details to be obtained from each network.")
 
-(defvar enwc-nm-sec-types
-  '(("eap-leap" . (("Name" . "eap-leap")
-   ("reqs" . ((("identity" . "Username")
-   ("password" . "Password"))
-("eap-peap" . (("Name" . "eap-peap")
-   ("reqs" . ((("anonymous-identity" . "Anonymous Identity")
-   ("ca-cert" . "CA Certificate")
-   ("phase2-auth" . "Inner Authentication")
-   ("phase1-peapver" . "PEAP Version")
-   ("identity" . "Username")
-   ("password" . "Password"))
-("eap-tls" . (("Name" . "eap-tls")
-  ("reqs" . ((("identity" . "Identity")
-  ("client-cert" . "User Certificate")
-  ("ca-cert" . "CA Certificate")
-  ("private-key" . "Private Key")
-  ("private-key-password" . "Private Key 
Password"))
-("eap-ttls" . (("Name" . "eap-ttls")
-   ("reqs" . ((("anonymous-identity" . "Anonymous Identity")
-   ("ca-cert" . "CA Certificate")
-   ("phase2-auth" . "Inner Authentication")
-   ("identity" . "Username")
-   ("password" . "Password"))
-("wpa-psk" . (("Name" . "wpa2")
-  ("reqs" . ((("psk" . "PSK"))
-("wep" . (("Name" . "wep")
-  ("reqs" . ((("wep-key0" . "WEP Key")
-  ("wep-key-type" . "WEP Key Type"))
-("leap" . (("Name" . "leap")
-   ("reqs" . ((("leap-username" . "Username")
-   ("leap-password" . "Password"))
-)
-  "The security types for NetworkManager.
-This is still in the process of being worked on."
-  )
-
 (defvar enwc-nm-wired-dev nil
   "The wired device object path.")
 
@@ -160,25 +124,28 @@ This is still in the process of being worked on."
  args))
 
 (defun enwc-nm-dbus-default-call-method (method  args)
-  (enwc-nm-dbus-call-method method nil nil args))
+  (apply 'enwc-nm-dbus-call-method method nil nil args))
 
 (defun enwc-nm-dbus-settings-call-method (method  args)
-  (enwc-nm-dbus-call-method method
-enwc-nm-dbus-settings-path
-enwc-nm-dbus-settings-interface
-args))
+  (apply 'enwc-nm-dbus-call-method
+ method
+ enwc-nm-dbus-settings-path
+ enwc-nm-dbus-settings-interface
+ args))
 
 (defun enwc-nm-dbus-wireless-call-method (method  args)
-  (enwc-nm-dbus-call-method method
-enwc-nm-wireless-dev
-enwc-nm-dbus-wireless-interface
-args))
+  (apply 'enwc-nm-dbus-call-method
+ method
+ enwc-nm-wireless-dev
+ enwc-nm-dbus-wireless-interface
+ args))
 
 (defun enwc-nm-dbus-wired-call-method (method  args)
-  (enwc-nm-dbus-call-method method
-enwc-nm-wired-dev
-enwc-nm-dbus-wired-interface
-args))
+  (apply 'enwc-nm-dbus-call-method
+ method
+ enwc-nm-wired-dev
+ enwc-nm-dbus-wired-interface
+ args))
 
 (defun enwc-nm-get-settings (conn)
   "Gets the connection settings.
@@ -198,9 +165,9 @@ CONN is an object path to the connection."
 (defun enwc-nm-get-device-by-name (name)
   (enwc-nm-dbus-default-call-method "GetDeviceByIpIface" :string name))
 
-;
-;; Get networks
-;
+;;
+;; Get networks ;;
+;;
 
 (defun enwc-nm-get-networks ( wired)
   (if 

[elpa] master 7a3c057 03/76: Added support for toggling the mode line display.

2017-02-23 Thread Ian Dunn
branch: master
commit 7a3c057541d02758e6bb4c6736501fb782c6c82b
Author: Ian D 
Commit: Ian D 

Added support for toggling the mode line display.
---
 lisp/enwc-setup.el |  5 +++--
 lisp/enwc.el   | 17 +
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index c0e3ac2..fddcd08 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -97,8 +97,9 @@
   "Sets up ENWC.
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
-  (setq global-mode-string (append global-mode-string
-  '(enwc-display-string)))
+  (if enwc-display-mode-line
+  (setq global-mode-string (append global-mode-string
+   '(enwc-display-string
   (run-at-time t 1 'enwc-update-mode-line)
 
   (let ((cur-back nil)
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 825cb5f..f851b62 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -70,6 +70,14 @@ and the first active backend found will be used."
   :group 'enwc
   :type 'list)
 
+(defcustom enwc-display-mode-line 't
+  "Whether or not to use ENWC's modeline display.
+When set to non-nil, this will cause the current
+network signal strength to be displayed on the
+Emacs mode line."
+  :group 'enwc
+  :type 'boolean)
+
 ;;; The function variables for the abstract layer.
 
 (defvar enwc-scan-func nil
@@ -427,6 +435,15 @@ This is initiated during setup, and runs once every 
second."
(number-to-string str))
  "%] "
 
+(defun enwc-toggle-display-mode-line ()
+  "Toggles the mode line display."
+  (interactive)
+  (let ((new (not enwc-display-mode-line)))
+(if new
+(setq global-mode-string (append global-mode-string 
'(enwc-display-string)))
+  (setq global-mode-string (delq 'enwc-display-string global-mode-string)))
+(setq enwc-display-mode-line new)))
+
 ;;
 ;; Scan internal
 ;;



[elpa] master f77237c 12/76: (enwc-format-mode-line-string): Checks to confirm that scan data exists.

2017-02-23 Thread Ian Dunn
branch: master
commit f77237c65f6e466f45f0319ef9ae2c3d2d70d619
Author: Ian D 
Commit: Ian D 

(enwc-format-mode-line-string): Checks to confirm that scan data exists.
---
 lisp/enwc.el | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 872e70a..6b94115 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -465,7 +465,8 @@ See the documentation for it for more details."
 ((eq (elt f (1- p)) ?s)
  (cond
   ((enwc-is-wired-p) "100")
-  ((not (enwc-is-valid-nw-id cur-id)) "0")
+  ((or (not (enwc-is-valid-nw-id cur-id))
+   (not enwc-last-scan))"0")
   ((enwc-check-connecting-p) "*")
   (t (number-to-string
   (cdr (assoc "quality" (nth cur-id enwc-last-scan)))
@@ -473,13 +474,15 @@ See the documentation for it for more details."
  (cond
   ((enwc-is-wired-p) "Wired")
   ((or (not (enwc-is-valid-nw-id cur-id))
-   (enwc-check-connecting-p)) "None")
+   (enwc-check-connecting-p)
+   (not enwc-last-scan)) "None")
   (t (cdr (assoc "essid" (nth cur-id enwc-last-scan))
 ((eq (elt f (1- p)) ?b)
  (cond
   ((enwc-is-wired-p) "wired")
   ((or (not (enwc-is-valid-nw-id cur-id))
-   (enwc-check-connecting-p)) "none")
+   (enwc-check-connecting-p)
+   (not enwc-last-scan)) "none")
   (t (cdr (assoc "bssid" (nth cur-id enwc-last-scan))
 ((eq (elt f (1- p)) ?%) "%"))
 fin-str))



[elpa] master c4ac6fc 60/76: Fixed bug in 'enwc-load-default-backend'

2017-02-23 Thread Ian Dunn
branch: master
commit c4ac6fc97b003c8e0ea6c72b49f212440fb67f86
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed bug in 'enwc-load-default-backend'

* enwc.el (enwc-load-default-backend): Fixed to use 'enwc-default-backend'
  instead of the corresponding map entry.
---
 lisp/enwc-backend.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/enwc-backend.el b/lisp/enwc-backend.el
index e79b8d2..61e78a2 100644
--- a/lisp/enwc-backend.el
+++ b/lisp/enwc-backend.el
@@ -135,7 +135,7 @@ Signals an error if a backend with KEY already exists and 
FORCEP is nil."
 (setq enwc--current-backend new-backend)))
 
 (defun enwc-load-default-backend ()
-  (enwc-load-backend (map-elt enwc-registered-backend-alist 
enwc-default-backend)))
+  (enwc-load-backend enwc-default-backend))
 
 (defun enwc-unload-current-backend ()
   "Unload the current backend."



[elpa] master 8c17c8c 73/76: Updated hgignore to ignore elc files in top-level directory.

2017-02-23 Thread Ian Dunn
branch: master
commit 8c17c8c5fdff1cc66c0c2f81716968d4c3b4164a
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Updated hgignore to ignore elc files in top-level directory.
---
 .hgignore | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.hgignore b/.hgignore
index 284f56b..e1b6cde 100644
--- a/.hgignore
+++ b/.hgignore
@@ -1,4 +1,4 @@
 syntax: glob
 
-lisp/*.elc
-lisp/enwc-autoloads.el
\ No newline at end of file
+*.elc
+enwc-autoloads.el
\ No newline at end of file



[elpa] master a6b2b03 61/76: Removed tag 2.0

2017-02-23 Thread Ian Dunn
branch: master
commit a6b2b03067ab9f13d69e90b430b259ec434d5587
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Removed tag 2.0
---
 .hgtags | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.hgtags b/.hgtags
index d28cc38..39afd88 100644
--- a/.hgtags
+++ b/.hgtags
@@ -3,3 +3,5 @@
  2.0
  2.0
 cc2f7aa4ed369769e4aec5cdc4a6b1a2d28375b3 2.0
+cc2f7aa4ed369769e4aec5cdc4a6b1a2d28375b3 2.0
+ 2.0



[elpa] master bb68ed5 37/76: Added ignore rules for byte compiled files.

2017-02-23 Thread Ian Dunn
branch: master
commit bb68ed57fb8bd036c41c973d7162b17a79ad2e62
Author: Ian D 
Commit: Ian D 

Added ignore rules for byte compiled files.
---
 .bzrignore  |  1 +
 doc/nm-dbus.txt | 34 ++
 2 files changed, 35 insertions(+)

diff --git a/.bzrignore b/.bzrignore
new file mode 100644
index 000..c531d98
--- /dev/null
+++ b/.bzrignore
@@ -0,0 +1 @@
+*.elc
diff --git a/doc/nm-dbus.txt b/doc/nm-dbus.txt
index 89aa5a9..2d49ab0 100644
--- a/doc/nm-dbus.txt
+++ b/doc/nm-dbus.txt
@@ -354,3 +354,37 @@ Settings/0:
   
 
 "
+
+GetSettings: (a{sa{sv}})
+(("connection"
+  (("id"
+("Wired connection 1"))
+   ("uuid"
+("68ef4936-b67f-4973-bd31-84ce745f3150"))
+   ("timestamp"
+(1414346232))
+   ("type"
+("802-3-ethernet"
+ ("ipv4"
+  (("addresses"
+(nil))
+   ("dns"
+(nil))
+   ("method"
+("auto"))
+   ("routes"
+(nil
+ ("802-3-ethernet"
+  (("s390-options"
+(nil))
+   ("mac-address"
+((92 249 221 62 23 118)
+ ("ipv6"
+  (("addresses"
+(nil))
+   ("dns"
+(nil))
+   ("method"
+("auto"))
+   ("routes"
+(nil)



[elpa] master c8a0397 29/76: Fixed some compilation errors in enwc.el.

2017-02-23 Thread Ian Dunn
branch: master
commit c8a0397cc50f49e0db23b1ac65581566bce1f4c7
Author: Ian D 
Commit: Ian D 

Fixed some compilation errors in enwc.el.
---
 lisp/enwc.el | 45 +++--
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index ec54086..669360c 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -239,30 +239,31 @@ This is only used internally.")
   "The face for the connected network."
   :group 'enwc)
 
-(defun enwc--break-by-words (str)
-  "Break up string STR into a list of words."
-  (cl-check-type str string)
-  (split-string str "-\\|_\\| "))
-
-(defun enwc--sym-to-str (sym  seps)
-  "Create a string from symbol SYM.
+(eval-when-compile
+  (defun enwc--break-by-words (str)
+"Break up string STR into a list of words."
+(cl-check-type str string)
+(split-string str "-\\|_\\| "))
+
+  (defun enwc--sym-to-str (sym  seps)
+"Create a string from symbol SYM.
 SEPS is a string specifying the separator to use to combine the words,
 or \" \" if not specified."
-  (cl-check-type sym symbol)
-  (unless seps
-(setq seps " "))
-  (cl-check-type seps string)
-  (combine-and-quote-strings (enwc--break-by-words (symbol-name sym)) seps))
-
-(defun enwc--str-to-sym (str  seps)
-  "Create a symbol from the string STR.
+(cl-check-type sym symbol)
+(unless seps
+  (setq seps " "))
+(cl-check-type seps string)
+(combine-and-quote-strings (enwc--break-by-words (symbol-name sym)) seps))
+
+  (defun enwc--str-to-sym (str  seps)
+"Create a symbol from the string STR.
 This will break STR into words, and then put it back together separating
 each word by SEPS, which defaults to \"-\"."
-  (cl-check-type str string)
-  (unless seps
-(setq seps "-"))
-  (cl-check-type seps string)
-  (intern (combine-and-quote-strings (enwc--break-by-words str) seps)))
+(cl-check-type str string)
+(unless seps
+  (setq seps "-"))
+(cl-check-type seps string)
+(intern (combine-and-quote-strings (enwc--break-by-words str) seps
 
 (defun enwc--int-to-byte-list (n)
   "Convert 32-bit integer N into a byte list."
@@ -274,7 +275,7 @@ each word by SEPS, which defaults to \"-\"."
 
 (defun enwc--byte-list-to-int (bl)
   "Convert byte list BL into a 32-bit integer."
-  (cl-check-type n list)
+  (cl-check-type bl list)
   (let ((ret 0))
 (dolist (x bl ret)
   (setq ret (logior (lsh ret 8) x)
@@ -631,7 +632,7 @@ Otherwise, it actually returns it."
 need-break cur-net)
 (while (and nets (not cur-net))
   (setq cur-net (pop nets))
-  (unless (string-equal (alist-get 'essid (cdr-safe cur-ent))
+  (unless (string-equal (alist-get 'essid (cdr-safe cur-net))
 essid)
 (setq cur-net nil)))
 (if cur-net



[elpa] master cb32122 13/76: (enwc-nm-prop-to-prop, enwc-wicd-prop-to-prop): Convert the properties used internally to the property names used externally.

2017-02-23 Thread Ian Dunn
branch: master
commit cb321220de2ab88f4fe13bb7049878aaab7348e1
Author: Ian D 
Commit: Ian D 

(enwc-nm-prop-to-prop, enwc-wicd-prop-to-prop): Convert the properties used 
internally to the property names used externally.
(enwc-nm-get-wireless-nw-props, enwc-wicd-build-prop-list): Uses the 
external property names for the returned assocative list.
(enwc-nm-get-wireless-nw-props, enwc-wicd-get-wireless-nw-props): Get the 
encryption type in the back-ends instead of the front-end.
(enwc-setup-backend): No longer initializes enwc-details-list.
(enwc-wicd-get-current-nw-id): Uses the actual d-bus functions instead of 
tracking the network id internally.
(enwc-details-list): Initialized in the front-end.
(enwc-str-width): Changed to enwc-strength-width.
(enwc-chnl-width): Changed to enwc-channel-width.
(enwc-detail-to-ident): Removed.
(enwc-format-mode-line-string): Only calls the functions to check for a 
pending or wired connection once.
(enwc-enable-display-mode-line, enwc-disable-display-mode-line, 
enwc-toggle-auto-scan): Displays a message when finished.
(enwc-process-scan, enwc-display-wireless-networks): Sets the width of each 
display column
(enwc-process-scan): Redisplays the network list even when non-interactive.
---
 lisp/enwc-nm.el|  29 --
 lisp/enwc-setup.el |   3 --
 lisp/enwc-wicd.el  |  40 +++-
 lisp/enwc.el   | 109 +
 4 files changed, 106 insertions(+), 75 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 20b3d16..32a9245 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -299,7 +299,18 @@ PROP from that access point.  It also sets the channel 
from the
((= ret 2) "Infrastructure"
 ret))
 
+(defun enwc-nm-prop-to-prop (prop)
+  "Converts a NetworkManager property to an ENWC network property."
+  (cond
+   ((equal prop "Ssid") "essid")
+   ((equal prop "HwAddres") "bssid")
+   ((equal prop "Strength") "strength")
+   ((equal prop "Flags") "encrypt")
+   ((equal prop "Mode") "mode")
+   ((equal prop "Channel") "channel")))
+
 (defun enwc-nm-get-wireless-nw-props (id)
+  "Gets the network properties for the network with id ID."
   (let ((ap (nth id enwc-access-points))
tmp-val
ret)
@@ -310,14 +321,25 @@ PROP from that access point.  It also sets the channel 
from the
 (setq tmp-val (cdr (assoc "Mode" ret)))
 (setcdr (assoc "Frequency" ret)
(number-to-string (1+ (/ (- (cdr (assoc "Frequency" ret))
-   2412) 5
+   2412)
+ 5
 (setcdr (assoc "Ssid" ret)
(dbus-byte-array-to-string (cdr (assoc "Ssid" ret
 (setcdr (assoc "Mode" ret)
(cond ((= tmp-val 0) "Unkown")
  ((= tmp-val 1) "Ad-Hoc")
  ((= tmp-val 2) "Infrastructure")))
-ret))
+(let ((enc-type (enwc-nm-get-encryption-type id)))
+  (setcdr (assoc "Flags" ret)
+  (if enc-type
+  enc-type
+"Unsecured")))
+(mapcar
+ (lambda (x)
+   (cons (enwc-nm-prop-to-prop (car x))
+ (cdr x)))
+ ret)))
+;;ret))
 
 (defun enwc-nm-get-conn-by-nid (nid)
   "Gets a connection object with the network id NID."
@@ -901,8 +923,7 @@ and SETTINGS is the list of settings."
enwc-nm-dbus-path
enwc-nm-dbus-interface
"StateChanged"
-   'enwc-nm-prop-changed)
-  )
+   'enwc-nm-prop-changed))
 
 
 (provide 'enwc-nm)
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 2dc9f16..52f0a64 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -42,9 +42,6 @@
  enwc-get-wireless-nw-props-func (intern (concat "enwc-"
  sym-name
  
"-get-wireless-nw-props"))
- enwc-details-list (symbol-value (intern (concat "enwc-"
- sym-name
- "-details-list")))
  enwc-get-encryption-type-func (intern (concat "enwc-"
sym-name
"-get-encryption-type"))
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index b6db670..377987b 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -107,6 +107,16 @@ and appends the value to `enwc-wicd-prop-values'."
   (setq enwc-wicd-prop-values (cons (cons prop (car args)) 
enwc-wicd-prop-values))
   (setq enwc-wicd-prop-num (1+ enwc-wicd-prop-num)))
 
+(defun enwc-wicd-prop-to-prop (prop)
+  "Converts a Wicd network property to an ENWC network property."
+  (cond
+   ((equal 

[elpa] master ad38333 59/76: Cleaned up enwc-refresh-widths and changed enwc-details-list to enwc-column-specs.

2017-02-23 Thread Ian Dunn
branch: master
commit ad383336c7990e662d371a10c722e32e5fa80489
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Cleaned up enwc-refresh-widths and changed enwc-details-list to 
enwc-column-specs.

* enwc.el (enwc-refresh-widths): Cleaned up using pcase-let.
(enwc--get-details): Applied change to enwc-details-list.
(enwc--tabulated-list-printer): Same.
(enwc-display-wireless-networks): Same.
---
 lisp/enwc.el | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index ddd420e..4bc9539 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -37,6 +37,8 @@
 ;;
 ;; (require 'enwc)
 ;; (enwc-load-default-backend)
+;; (enwc-enable-auto-scan)
+;; (enwc-enable-display-mode-line)
 ;;
 ;; to your .emacs file (or other init file).
 
@@ -134,7 +136,7 @@ in `enwc-update-mode-line'.")
 (cl-defstruct enwc-column-spec ()
   detail display sorter width conv)
 
-(defconst enwc-details-list
+(defconst enwc-column-specs
   (list
(make-enwc-column-spec
 :detail 'strength
@@ -172,7 +174,7 @@ This will be an association list of the form:
 Each ID is a backend-specific network ID.
 
 Each key in the children association lists corresponds to an entry in
-`enwc-details-list'.")
+`enwc-column-specs'.")
 
 (defvar enwc-access-points nil
   "The most recent access point list.")
@@ -263,7 +265,7 @@ Returns `non-nil' if there is one, nil otherwise."
 (defun enwc-get-wireless-nw-props (id)
   "Get the network properties of the wireless network with id ID.
 This will return an associative list with the keys
-corresponding to `enwc-details-list'.
+corresponding to `enwc-column-specs'.
 
 ID is specific to the backend."
   (enwc--wireless-nw-props enwc--current-backend id))
@@ -468,21 +470,19 @@ ARGS is only for compatibility with the calling function."
 
 (cl-defun enwc-refresh-widths ( (networks enwc-last-scan))
   "Refresh the column widths for display."
-  (setq enwc-details-list
+  (setq enwc-column-specs
 (mapcar
- (lambda (detail)
-   (let ((new-max (seq-max
-   (map-apply
-;; TODO: prin1-to-string isn't the formatter.  Use
-;; the actual formatter function as specified by 
the
-;; conv.
-(lambda (id nw)
-  (length (prin1-to-string (alist-get 
(enwc-column-spec-detail detail) nw
-networks)))
- (min-width (1+ (length (enwc-column-spec-display detail)
- (setf (enwc-column-spec-width detail) (max new-max min-width))
- detail))
- enwc-details-list)))
+ (lambda (spec)
+   (pcase-let* (((cl-struct enwc-column-spec detail display conv) spec)
+(new-max (seq-max
+  (map-apply
+   (lambda (id nw)
+ (length (funcall conv (alist-get detail 
nw
+   networks)))
+(min-width (+ (length display) 2)))
+ (setf (enwc-column-spec-width spec) (max new-max min-width)))
+   spec)
+ enwc-column-specs)))
 
 (defun enwc-display-wired-networks (networks)
   "Display the wired networks specified in the list NETWORKS.
@@ -499,7 +499,7 @@ NETWORKS must be in the form returned from
   (mapcar
(lambda (detail)
  (alist-get (enwc-column-spec-detail detail) network-entry))
-   enwc-details-list))
+   enwc-column-specs))
 
 (defun enwc--tabulated-list-entries ()
   (map-apply
@@ -514,7 +514,7 @@ NETWORKS must be in the form returned from
  (vconcat
   (seq-map-indexed
(lambda (col idx)
- (let* ((detail (nth idx enwc-details-list))
+ (let* ((detail (nth idx enwc-column-specs))
 (conv   (funcall (enwc-column-spec-conv detail) col)))
(if (equal cur-id id)
(propertize conv 'font-lock-face 'enwc-connected)
@@ -532,7 +532,7 @@ NETWORKS must be in the form returned from
(mapcar
 (pcase-lambda ((cl-struct enwc-column-spec display width sorter))
   (list display width sorter))
-enwc-details-list)))
+enwc-column-specs)))
 (setq tabulated-list-entries #'enwc--tabulated-list-entries)
 (setq tabulated-list-printer #'enwc--tabulated-list-printer)
 



[elpa] master 48e7aa4 55/76: Updated Makefile

2017-02-23 Thread Ian Dunn
branch: master
commit 48e7aa46003db9c000f5337ebf1a848a23fb12af
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Updated Makefile
---
 lisp/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/Makefile b/lisp/Makefile
index 0789624..618ae33 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -18,9 +18,9 @@
 
 
 EMACS=emacs --batch
-ALLSRC=enwc.el enwc-wicd.el enwc-nm.el enwc-setup.el
+ALLSRC= enwc-backend.el enwc.el enwc-wicd.el enwc-nm.el
 ALLELC=$(wildcard *.elc)
-EXPER=enwc-cm.el
+EXPER=enwc-cm.el enwc-wpa.el enwc-edit.el
 SOURCE=$(ALLSRC)
 TARGET=$(patsubst %.el,%.elc,$(SOURCE))
 



[elpa] master 7914c48 10/76: (enwc-format-mode-line-string, enwc-update-mode-line): Added the option to customize the information displayed in the mode line.

2017-02-23 Thread Ian Dunn
branch: master
commit 7914c4861156f2c90a42cd6c739f84bc0a317d8c
Author: Ian D 
Commit: Ian D 

(enwc-format-mode-line-string, enwc-update-mode-line): Added the option to 
customize the information displayed in the mode line.
---
 lisp/enwc.el | 176 +++
 1 file changed, 106 insertions(+), 70 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index aba6027..6097957 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -90,6 +90,22 @@ networks every `enwc-auto-scan-interval' seconds."
   :group 'enwc
   :type 'integer)
 
+(defcustom enwc-mode-line-format "[%s%%]"
+  "The format for displaying the mode line.
+
+%s = The current signal strength.  If wired, then this is set to
+100.
+
+%e = The essid of the current network.  If wired, then this set to
+'Wired'
+
+%b = The bssid of the current network.  If using a wired connection,
+then this is set to 'Wired'.
+
+%% = A Normal '%'"
+  :group 'enwc
+  :type 'string)
+
 ;;; The function variables for the abstract layer.
 
 (defvar enwc-scan-func nil
@@ -264,16 +280,7 @@ This is only used internally.")
   "The timer for automatic scanning.")
 
 (make-local-variable 'enwc-edit-id)
-;; The Fonts
-
-;; (defface enwc-header-face
-;;   'class color) (background light))
-;;  (:foreground "Blue"))
-;; (((class color) (background dark))
-;;  (:foreground "Blue"))
-;; (t (:background "Blue")))
-;;   "The face for the headers."
-;;   :group 'enwc)
+;; The Faces
 
 (defface enwc-connected-face
   'class color) (background dark))
@@ -288,7 +295,9 @@ This is only used internally.")
 ;; Small helper function.
 
 (defun enwc-detail-to-ident (detail)
-  "Converts detail DETAIL to a constant identifier."
+  "Converts network detail DETAIL to a constant identifier.
+This function is used to synchronize the different backends
+to display consistent results."
   (case (intern detail)
 ((essid Ssid) "essid")
 ((bssid HwAddress) "bssid")
@@ -434,29 +443,51 @@ WIRED indicates whether or not this is a wired 
connection."
   (enwc-get-wired-nw-prop id prop)
 (enwc-get-wireless-nw-prop id prop)))
 
+(defun enwc-format-mode-line-string ()
+  "Formats the mode line string.
+This is derived from `enwc-mode-line-format'.
+See the documentation for it for more details."
+  (if (enwc-check-connecting-p)
+  "[*]"
+(let* ((f enwc-mode-line-format)
+   (p 0)
+   (l (length f))
+   (cur-id (enwc-get-current-nw-id))
+   c fin-str)
+  (while (< p l)
+(setq c (elt f p))
+(setq p (1+ p))
+(setq fin-str
+  (concat
+   fin-str
+   (if (not (eq c ?%))
+   (char-to-string c)
+ (setq p (1+ p))
+ (cond
+  ((eq (elt f (1- p)) ?s)
+   (if (enwc-is-wired-p)
+   "100"
+ (number-to-string
+  (cdr (assoc "quality" (nth cur-id enwc-last-scan))
+  ((eq (elt f (1- p)) ?e)
+   (if (enwc-is-wired-p)
+   "Wired"
+ (cdr (assoc "essid" (nth cur-id enwc-last-scan)
+  ((eq (elt f (1- p)) ?b)
+   (if (enwc-is-wired-p)
+   "wired"
+ (cdr (assoc "bssid" (nth cur-id enwc-last-scan)
+  ((eq (elt f (1- p)) ?%) "%"))
+  fin-str)))
+
 (defun enwc-update-mode-line ()
-  "Updates the mode line with the current network strength.
-If no network is connected, then prints 0%.
-If wired is active, then prints 100%.
-If ENWC is in the process of connecting, then prints *%.
+  "Updates the mode line display.
+This uses the format specified by `enwc-mode-line-format'.
 This is initiated during setup, and runs once every second."
  (let ((cur-id (enwc-get-current-nw-id))
-   (conn (enwc-check-connecting-p))
-   str)
-(setq str
- (if (enwc-is-wired-p)
- 100
-   (if (and
-(enwc-is-valid-nw-id cur-id)
-enwc-last-scan)
-   (cdr (assoc "quality" (nth cur-id enwc-last-scan)))
- 0)))
-(setq enwc-display-string (concat " ["
- (if conn
- "*"
-   (number-to-string str))
- "%] "))
-(force-mode-line-update)))
+   (conn (enwc-check-connecting-p)))
+   (setq enwc-display-string (enwc-format-mode-line-string))
+   (force-mode-line-update)))
 
 (defun enwc-enable-display-mode-line ()
   "Enables the mode line display."
@@ -618,44 +649,45 @@ ENT is the entry, and WIDTH is the column width."
   "Displays the networks in the list NETWORKS in the current buffer.
 NETWORKS must be in the format returned by
 `enwc-scan-internal-wireless'."
-  (if (not (eq major-mode 

[elpa] master 773cef6 24/76: (enwc-backend-symbol-list): New variable.

2017-02-23 Thread Ian Dunn
branch: master
commit 773cef6e1f2af7ace3b90292e180ab7ab79fcead
Author: Ian D 
Commit: Ian D 

(enwc-backend-symbol-list): New variable.
(enwc--setq-backend): New function to improve readability.
(enwc-setup-backend): Implemented `enwc-backend-symbol-list' and 
`enwc--setq-backend'.
(enwc-setup): Cleaned up code.
---
 lisp/enwc-setup.el | 36 ++--
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 086cc08..649eaef 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -27,24 +27,32 @@
 (require 'enwc-wicd)
 (require 'enwc-nm)
 
+(defvar enwc-backend-symbol-list
+  '("scan"
+"get-networks"
+"get-wireless-nw-props"
+"connect"
+"disconnect"
+"get-current-nw-id"
+"check-connecting"
+"is-wired"
+"get-profile-info"
+"save-nw-settings"))
+
 (defun enwc--intern-sym (sym-name suffix)
   (intern (concat "enwc-" sym-name suffix)))
 
+(defun enwc--setq-backend (backend func)
+  "Set a backend function."
+  (set (intern (concat "enwc-" func "-func"))
+   (intern (concat "enwc-" backend "-" func
+
 (defun enwc-setup-backend (cur-back)
   "Sets up ENWC to use the correct function for the backend CUR-BACK."
   (let* ((sym-name (symbol-name cur-back))
- (eis (apply-partially 'enwc--intern-sym sym-name)))
-(setq enwc-scan-func (funcall eis "-scan")
-  enwc-get-networks-func (funcall eis "-get-networks")
-  enwc-get-wireless-nw-props-func (funcall eis 
"-get-wireless-nw-props")
-  enwc-connect-func (funcall eis "-connect")
-  enwc-disconnect-func (funcall eis "-disconnect")
-  enwc-get-current-nw-id-func (funcall eis "-get-current-nw-id")
-  enwc-check-connecting-func (funcall eis "-check-connecting")
-  enwc-is-wired-func (funcall eis "-is-wired")
-  enwc-get-profile-info-func (funcall eis "-get-profile-info")
-  enwc-save-nw-settings-func (funcall eis "-save-nw-settings"))
-(funcall (funcall eis "-setup"
+ (esb (apply-partially 'enwc--setq-backend sym-name)))
+(cl-mapc esb enwc-backend-symbol-list)
+(funcall (enwc--intern-sym sym-name "-setup"
 
 (defun enwc-setup ()
   "Sets up ENWC.
@@ -57,8 +65,8 @@ on D-Bus."
 (setq enwc-scan-timer
   (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
 
-  (let ((cur-back nil)
-(back-list enwc-backends))
+  (let ((back-list enwc-backends)
+cur-back)
 (while (and back-list (not cur-back))
   (setq cur-back (pop back-list))
   (unless (dbus-ping :system



[elpa] master 43c98da 50/76: Changed enwc-last-scan to a hashtable.

2017-02-23 Thread Ian Dunn
branch: master
commit 43c98da102e22d45f101949c52eb3367dd12ad1d
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Changed enwc-last-scan to a hashtable.

* enwc.el (enwc-process-scan): Use 'map-into' to create the hash-table
  (enwc-value-from-scan): Use `map-nested-elt' to get value.

Added map library as requirement.
---
 lisp/enwc.el | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 540bc90..52bbce3 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -51,6 +51,7 @@
 (require 'cl-lib)
 (require 'cl-macs)
 (require 'format-spec)
+(require 'map)
 
 (defgroup enwc nil
   "*The Emacs Network Client"
@@ -92,7 +93,7 @@ networks every `enwc-auto-scan-interval' seconds."
   :group 'enwc
   :type 'integer)
 
-(defcustom enwc-mode-line-format "[%s%%]"
+(defcustom enwc-mode-line-format " [%s%%] "
   "The format for displaying the mode line.
 
 %s = The current signal strength.  If wired, then this is set to 100.
@@ -353,7 +354,7 @@ If DETAIL is not found in `enwc-last-scan', then return 
nil."
   (unless id
 (setq id (enwc-get-current-nw-id)))
   (when enwc-last-scan
-(alist-get detail (alist-get id enwc-last-scan
+(map-nested-elt enwc-last-scan `(,id ,detail
 
 (defun enwc-make-format-spec ()
   "Create a format specification for the mode line string."
@@ -507,10 +508,12 @@ ARGS is only for compatibility with the calling function."
   enwc-access-points  (enwc-get-networks))
 (when enwc-scan-interactive
   (message "Scanning... Done"))
-(setq enwc-last-scan (mapcar
-  (lambda (ap)
-`(,ap . ,(enwc-get-wireless-nw-props ap)))
-  enwc-access-points))
+(setq enwc-last-scan (map-into
+  (mapcar
+   (lambda (ap)
+ `(,ap . ,(enwc-get-wireless-nw-props ap)))
+   enwc-access-points)
+  'hash-table))
 (enwc-display-wireless-networks enwc-last-scan)
 (setq enwc-scan-interactive nil)))
 



[elpa] master ec0539b 42/76: Fixed enwc-setup to be able to be called more than once.

2017-02-23 Thread Ian Dunn
branch: master
commit ec0539b41189a124582a1ce7ee0159f994856042
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed enwc-setup to be able to be called more than once.

* enwc.el (enwc-mode-line-timer): Create new variable to track mode-line 
timer.

* enwc-setup.el (enwc-setup): Use cl-pushnew instead of append to add to 
global-mode-string.
  Use new variable for timer.
---
 lisp/enwc-setup.el | 7 +++
 lisp/enwc.el   | 2 ++
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index c0e3ac2..014cb74 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -97,10 +97,9 @@
   "Sets up ENWC.
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
-  (setq global-mode-string (append global-mode-string
-  '(enwc-display-string)))
-  (run-at-time t 1 'enwc-update-mode-line)
-
+  (cl-pushnew 'enwc-display-string global-mode-string :test #'equal)
+  (unless enwc-mode-line-timer
+(setq enwc-mode-line-timer (run-at-time t 1 'enwc-update-mode-line)))
   (let ((cur-back nil)
(back-list enwc-backends))
 (while (and back-list (not cur-back))
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 83aa6d6..5308e2b 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -233,6 +233,8 @@ whether or not ENWC is in wired mode.")
 
 (defvar enwc-scan-interactive nil)
 
+(defvar enwc-mode-line-timer nil)
+
 (make-local-variable 'enwc-edit-id)
 ;; The Fonts
 



[elpa] master 3662795 23/76: (enwc-cm-scan, enwc-cm-dict-assoc, enwc-cm-get-network-props): Cleaned up code.

2017-02-23 Thread Ian Dunn
branch: master
commit 3662795d9c0e1ae511c156d826eb666a719073f5
Author: Ian D 
Commit: Ian D 

(enwc-cm-scan, enwc-cm-dict-assoc, enwc-cm-get-network-props): Cleaned up 
code.
(enwc-cm-get-profile-props, enwc-cm-save-profile): Updated to fit new 
front-end.
---
 lisp/enwc-cm.el | 66 -
 1 file changed, 32 insertions(+), 34 deletions(-)

diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
index 5ff6eef..2b54e44 100644
--- a/lisp/enwc-cm.el
+++ b/lisp/enwc-cm.el
@@ -35,7 +35,7 @@
 
 (defgroup enwc-cm nil
   "*ConnMan variables for ENWC"
-  :prefix "ewnc-cm-"
+  :prefix "enwc-cm-"
   :group 'enwc)
 
 (defcustom enwc-cm-dbus-service "net.connman"
@@ -43,8 +43,6 @@
   :group 'enwc-cm
   :type 'string)
 
-;; DEMAND TO SEE LIFE'S MANAGER!!
-
 (defcustom enwc-cm-dbus-manager-interface "net.connman.Manager"
   "ConnMan D-Bus Manager interface."
   :group 'enwc-cm
@@ -118,7 +116,8 @@
 
 ;; scan
 (defun enwc-cm-scan (wired)
-  (let ((path (if wired (enwc-cm-get-wired-tech-path)
+  (let ((path (if wired
+  (enwc-cm-get-wired-tech-path)
 (enwc-cm-get-wifi-tech-path
 (dbus-call-method-asynchronously :system
  path
@@ -135,15 +134,15 @@
 ;;  "Scan"))
 
 ;; get-network-props
+;; Might combine this with enwc-nm-get-dbus-dict-entry
 (defun enwc-cm-dict-assoc (dict prop)
   (let ((path-list (split-string prop "/"))
 (cur-list dict))
 (while (and path-list cur-list)
   (let ((cur-path (pop path-list)))
 (setq cur-list
-  (if (assoc cur-path cur-list)
-  (caadr (assoc cur-path cur-list))
-nil
+  (when (assoc cur-path cur-list)
+(caadr (assoc cur-path cur-list))
 (if (and cur-list (consp cur-list)) (car cur-list) cur-list)))
 
 (defun enwc-cm-get-nw-prop (id prop)
@@ -152,10 +151,10 @@
 
 (defun enwc-cm-get-network-props (id wired)
   (let ((network (enwc-cm-get-network id))
- props)
+props)
 ;; network should be a pair, (path . props)
-(if (not network)
-(error "Invalid Network Id %d" id))
+(unless network
+  (error "Invalid Network Id %d" id))
 (setq props (cadr network))
 (mapcar
  (lambda (det)
@@ -171,16 +170,16 @@
 props
 ipv4-settings
 dns-settings)
-(if (not network)
-(error "Invalid Network Id %d" id))
+(unless network
+  (error "Invalid Network Id %d" id))
 (setq props (cadr network))
-(setq ipv4-settings (enwc-cm-dict-assoc "IPv4.Configuration" props)
-  dns-settings  (enwc-cm-dict-assoc "Domains.Configuration" props))
-`(("addr". ,(cadr (assoc "Address" ipv4-settings)))
-  ("netmask" . ,(cadr (assoc "Netmask" ipv4-settings)))
-  ("gateway" . ,(cadr (assoc "Gateway" ipv4-settings)))
-  ("dns1". ,(nth 0 dns-settings))
-  ("dns2". ,(nth 1 dns-settings)
+(setq ipv4-settings (enwc-cm-dict-assoc "IPv4/Configuration" props)
+  dns-settings  (enwc-cm-dict-assoc "Domains/Configuration" props))
+`((addr. ,(cadr (assoc "Address" ipv4-settings)))
+  (netmask . ,(cadr (assoc "Netmask" ipv4-settings)))
+  (gateway . ,(cadr (assoc "Gateway" ipv4-settings)))
+  (dns1. ,(nth 0 dns-settings))
+  (dns2. ,(nth 1 dns-settings)
 
 ;; get-current-nw-id
 (defun enwc-cm-is-disconnected-p (service)
@@ -208,10 +207,10 @@
 (enwc-cm--find-connected-service services 0)))
 
 ;; save-profile
-(defun enwc-cm-set-nw-prop (wired id prop val)
+(defun enwc-cm-set-nw-prop (nw prop val  wired)
   (dbus-call-method :system
 enwc-cm-dbus-service
-(car (enwc-cm-get-network id))
+(car nw)
 enwc-cm-dbus-service-interface
 "SetProperty"
 :string prop
@@ -222,25 +221,25 @@
 props
 ipv4-settings
 dns-settings)
-(if (not network)
-(error "Invalid Network Id %d" id))
+(unless network
+  (error "Invalid Network Id %d" id))
 (setq props (cadr network))
 (setq ipv4-settings
   `((("Method" ("manual"))
- ("Address" (,(cdr (assoc "addr" settings
- ("Netmask" (,(cdr (assoc "netmask" settings
- ("Gateway" (,(cdr (assoc "gateway" settings)))
+ ("Address" (,(alist-get 'addr settings "")))
+ ("Netmask" (,(alist-get 'netmask settings "")))
+ ("Gateway" (,(alist-get 'gateway settings ""))
 (setq dns-settings
-  `((,(cdr (assoc "dns1" settings)))
-(,(cdr (assoc "dns2" settings)
-(enwc-cm-set-nw-prop wired prof "IPv4.Configuration" ipv4-settings)
-(enwc-cm-set-nw-prop wired prof "Domains.Configuration" dns-settings)))
+  `((,(alist-get 'dns1 settings ""))
+(,(alist-get 'dns2 

[elpa] master d6aa3ee 02/76: Fixed up enwc-wicd network properties.

2017-02-23 Thread Ian Dunn
branch: master
commit d6aa3eeea915158e26be60baa736ba06db7dcb07
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

Fixed up enwc-wicd network properties.
---
 lisp/enwc-wicd.el | 36 ++--
 lisp/enwc.el  | 82 +++
 2 files changed, 43 insertions(+), 75 deletions(-)

diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index 0343648..f02f4b6 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -1,6 +1,6 @@
 ;;; enwc-wicd.el --- The Wicd backend to ENWC
 
-;; Copyright (C) 2012,2013 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -100,8 +100,11 @@ the wicd wired interface."
 (defvar enwc-wicd-prop-num 0)
 (defvar enwc-wicd-prop-timeout 3)
 
-(defun enwc-wicd-nw-prop-handler ( args)
-  (setq enwc-wicd-prop-values (cons args enwc-wicd-prop-values))
+(defun enwc-wicd-nw-prop-handler (prop  args)
+  "The handler for `enwc-wicd-get-wireless-network-property'.
+This receives the value of network property PROP,
+and appends the value to `enwc-wicd-prop-values'."
+  (setq enwc-wicd-prop-values (cons (cons prop (car args)) 
enwc-wicd-prop-values))
   (setq enwc-wicd-prop-num (1+ enwc-wicd-prop-num)))
 
 (defun enwc-wicd-get-wireless-network-property (id prop)
@@ -113,7 +116,7 @@ from wireless network with id ID."
   enwc-wicd-dbus-wireless-path
   enwc-wicd-dbus-wireless-interface
   "GetWirelessProperty"
-  'enwc-wicd-nw-prop-handler
+  `(lambda (x) (enwc-wicd-nw-prop-handler 
,prop x))
:timeout 1000
   :int32 id
   :string prop))
@@ -121,14 +124,21 @@ from wireless network with id ID."
 (defun enwc-wicd-build-prop-list (prop-list det-list)
   (let (ret
(act-det-list (reverse det-list)))
-(while prop-list
-  (let ((cur-prop (pop prop-list))
-   (cur-det (pop act-det-list)))
-   (setq ret (append ret (cons (cons cur-det (car cur-prop)) nil)))
+(while act-det-list
+  (let* ((cur-det (pop act-det-list))
+(cur-prop (assoc cur-det prop-list)))
+(setq ret
+  (if cur-prop
+  (cons cur-prop ret)
+(cons (cons cur-det nil) nil)))
))
 ret))
 
 (defun enwc-wicd-get-wireless-nw-props (id)
+  "Get the network properties of a network.
+This function returns an associative list of properties
+for the network with id ID.
+For a list of properties, see `enwc-wicd-details-list'."
   (setq enwc-wicd-prop-values nil)
   (setq enwc-wicd-prop-num 0)
   (mapc (lambda (x)
@@ -138,8 +148,7 @@ from wireless network with id ID."
   (with-timeout (enwc-wicd-prop-timeout)
   (while (< enwc-wicd-prop-num 6)
(read-event nil nil 0.001)))
-  (while (< enwc-wicd-prop-num 6)
-(enwc-wicd-nw-prop-handler nil))
+
   (enwc-wicd-build-prop-list enwc-wicd-prop-values enwc-wicd-details-list))
 
 (defun enwc-wicd-get-encryption-type (id)
@@ -159,7 +168,6 @@ network with id ID."
   "Wicd get current network id function.
 This calls the D-Bus method on Wicd to get the current
 wireless network id."
-  ;;(enwc-wicd-dbus-wireless-call-method "GetCurrentNetworkID"))
   (if wired
   -1
 enwc-wicd-current-nw-id))
@@ -332,8 +340,7 @@ the network with id ID."
   (nthcdr 3 info)
   (caar (nthcdr 3 info))
   (string-to-number (caar (nthcdr 
3 info
- -1)))
-  ))
+ -1)
 
 (defun enwc-wicd-setup ()
   ;; Thanks to Michael Albinus for pointing out this signal.
@@ -349,8 +356,7 @@ the network with id ID."
"/org/wicd/daemon"
enwc-wicd-dbus-service
"StatusChanged"
-   'enwc-wicd-wireless-prop-changed)
-  )
+   'enwc-wicd-wireless-prop-changed))
 
 (provide 'enwc-wicd)
 
diff --git a/lisp/enwc.el b/lisp/enwc.el
index a131516..825cb5f 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -308,6 +308,7 @@ network with id ID."
   "Gets the list of wired profiles."
   (funcall enwc-get-wired-profiles-func))
 
+;;TODO: Add hooks to run after connecting.
 (defun enwc-wireless-connect (id)
   "Begins a connection to wireless network with
 id ID."
@@ -446,14 +447,18 @@ the scan results."
   (if (or enwc-using-wired (not enwc-scan-requested))
   nil
 (setq enwc-scan-requested nil)
-(let ((cur-id 0))
+(let (

[elpa] master 218aa82 25/76: Fixed prefix of customization group.

2017-02-23 Thread Ian Dunn
branch: master
commit 218aa82b8cfd1dec16a73fdfb5ee44c6309c4b96
Author: Ian D 
Commit: Ian D 

Fixed prefix of customization group.
(enwc-sec-types): Removed.
(enwc-get-profile-info-func): Removed.
(enwc-last-scan): Improved docstring.
(enwc--int-to-byte-list, enwc--byte-list-to-int, enwc--htonl): Added type 
checking.
(enwc-update-width): Cleaned up code.
(enwc-maybe-pretty-entry): Removed.
(enwc--propertize-entry): Added to replace `enwc-maybe-pretty-entry'.
(enwc-display-wireless-networks): Implemented `enwc--propertize-entry'.
(enwc-display-networks, enwc-find-network): Cleaned up code.
(enwc-supplicant-template-alist): Fixed up default settings.
(enwc-sec-widget-data): Fixed to handle phase 1 and phase 2 templates.
---
 lisp/enwc.el | 159 ++-
 1 file changed, 82 insertions(+), 77 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 9b0252e..ec54086 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -51,7 +51,7 @@
 
 (defgroup enwc nil
   "*The Emacs Network Client"
-  :prefix "ewnc-"
+  :prefix "enwc-"
   :group 'applications)
 
 (defcustom enwc-wireless-device "wlan0"
@@ -110,11 +110,6 @@ connection.
   :group 'enwc
   :type 'string)
 
-(defcustom enwc-sec-types
-  '("wpa" "wep" "wpa-leap" "wpa-peap" "leap" "peap")
-  "The security types used for ENWC.
-Each of these have associations within the back-ends.")
-
 ;;; The function variables for the abstract layer.
 
 (defvar enwc-scan-func nil
@@ -151,8 +146,6 @@ check whether or not a wired connection is active.")
 
 (defvar enwc-get-profile-info-func nil)
 
-(defvar enwc-get-profile-sec-info-func nil)
-
 (defvar enwc-save-nw-settings-func nil
   "The function variable to be used in `enwc-save-nw-settings'.
 This is redefined during setup to be the function to save
@@ -192,7 +185,16 @@ WIDTH is used during display to keep track of the width of 
each one.
 CONV is the conversion function used during display.")
 
 (defvar enwc-last-scan nil
-  "The most recent scan results.")
+  "The most recent scan results.
+
+This will be an association list of the form:
+
+((ID . ((strength . STRENGTH) (essid . ESSID) ...)) ...)
+
+Each ID is a backend-specific network ID.
+
+Each key in the children association lists corresponds to an entry in
+`enwc-details-alist'.")
 
 (defvar enwc-access-points nil
   "The most recent access point list.")
@@ -264,6 +266,7 @@ each word by SEPS, which defaults to \"-\"."
 
 (defun enwc--int-to-byte-list (n)
   "Convert 32-bit integer N into a byte list."
+  (cl-check-type n integer)
   (let (ret)
 (dotimes (x 4 ret)
   (push (logand n 255) ret)
@@ -271,12 +274,14 @@ each word by SEPS, which defaults to \"-\"."
 
 (defun enwc--byte-list-to-int (bl)
   "Convert byte list BL into a 32-bit integer."
+  (cl-check-type n list)
   (let ((ret 0))
 (dolist (x bl ret)
   (setq ret (logior (lsh ret 8) x)
 
 (defun enwc--htonl (n)
   "Convert 32-bit integer N from hardware to network byte order."
+  (cl-check-type n integer)
   (enwc--byte-list-to-int (nreverse (enwc--int-to-byte-list n
 
 
@@ -509,12 +514,11 @@ This modifies the width entry in `enwc-details-alist' 
that corresponds to
 DETAIL.
 
 If VAL is not specified, then use the width of the display name for DETAIL."
-  (unless val
-(setq val (1+ (length (cdr (assq 'display (cdr (assq detail 
enwc-details-alist
-  (setq val
-(max val (cdr (assq 'width (cdr (assq detail enwc-details-alist))
-  (setcdr (assq 'width (cdr (assq detail enwc-details-alist)))
-  val))
+  (let ((det (alist-get detail enwc-details-alist)))
+(unless val
+  (setq val (1+ (length (alist-get 'display det)
+(setq val (max val (alist-get 'width det)))
+(setcdr (assq 'width det) val)))
 
 (defun enwc-reset-widths ()
   "Reset the column widths for display."
@@ -560,11 +564,19 @@ NETWORKS must be in the form returned from
   (insert pr)
   (insert "\n"
 
-(defmacro enwc-maybe-pretty-entry (entry)
-  `(if (eq cur-id (cdr (assq 'id nw)))
-   (propertize ,entry
-   'font-lock-face 'enwc-connected-face)
- ,entry))
+(defmacro enwc--propertize-entry (network-entry)
+  "Propertize network entry NETWORK-ENTRY."
+  `(mapcar
+(lambda (det)
+  (let* ((conv (alist-get 'conv (cdr det)))
+ (ent  (alist-get (car det) (cdr ,network-entry)))
+ (conv-ent (funcall conv ent)))
+(if (equal cur-id (car nw))
+(propertize conv-ent
+'font-lock-face
+'enwc-connected-face)
+  conv-ent)))
+enwc-details-alist))
 
 (defun enwc-display-wireless-networks (networks)
   "Displays the networks in the list NETWORKS in the current buffer.
@@ -572,11 +584,9 @@ NETWORKS must be in the format returned by
 `enwc-scan-internal-wireless'."
   (unless (get-buffer "*ENWC*")
 

[elpa] master 4a3acfc 07/76: * enwc.el (enwc-enable-display-mode-line, enwc-disable-display-mode-line, enwc-toggle-display-mode-line): Broke enable/disable mode line functionality into different funct

2017-02-23 Thread Ian Dunn
branch: master
commit 4a3acfcc096b4bc09185e941c302d1e689df613c
Author: Ian D 
Commit: Ian D 

* enwc.el (enwc-enable-display-mode-line, enwc-disable-display-mode-line, 
enwc-toggle-display-mode-line): Broke enable/disable mode line functionality 
into different functions.

* enwc-setup.el (enwc-setup): Uses enwc-enable-display-mode-line to enable 
the mode line if requested by the user.
---
 lisp/enwc-setup.el | 14 ++
 lisp/enwc.el   | 32 +---
 2 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 66004f6..ec6bf9d 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -97,10 +97,16 @@
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
   (if enwc-display-mode-line
-  (setq global-mode-string (append global-mode-string
-   '(enwc-display-string
-  (setq enwc-display-mode-line-timer 
-(run-at-time t 1 'enwc-update-mode-line))
+  (enwc-enable-display-mode-line)
+  ;; (progn
+  ;;   (unless (member 'enwc-display-string
+  ;;   global-mode-string)
+  ;; (setq global-mode-string (append global-mode-string
+  ;;  '(enwc-display-string
+  ;;   (setq enwc-display-mode-line-timer 
+  ;; (run-at-time t 1 'enwc-update-mode-line)))
+)
+  
 
   (if (and enwc-auto-scan (> enwc-auto-scan-interval 0))
   (setq enwc-scan-timer
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 0723aa6..a11c307 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -456,15 +456,34 @@ This is initiated during setup, and runs once every 
second."
  "*"
(number-to-string str))
  "%] "
+(defun enwc-enable-display-mode-line ()
+  "Enables the mode line display."
+  (interactive)
+  (or global-mode-string (setq global-mode-string '("")))
+  (setq enwc-display-mode-line t)
+  (unless (member 'enwc-display-string
+  global-mode-string)
+(setq global-mode-string (append global-mode-string 
'(enwc-display-string
+  (if (not enwc-display-mode-line-timer)
+  (setq enwc-display-mode-line-timer
+(run-at-time t 1 'enwc-update-mode-line
+
+(defun enwc-disable-display-mode-line ()
+  "Disables the mode line display."
+  (interactive)
+  (or global-mode-string (setq global-mode-string '("")))
+  (setq enwc-display-mode-line nil)
+  (setq global-mode-string (remove 'enwc-display-string global-mode-string))
+  (if enwc-display-mode-line-timer
+  (cancel-timer enwc-display-mode-line-timer))
+  (setq enwc-display-mode-line-timer nil))
 
 (defun enwc-toggle-display-mode-line ()
   "Toggles the mode line display."
   (interactive)
-  (let ((new (not enwc-display-mode-line)))
-(if new
-(setq global-mode-string (append global-mode-string 
'(enwc-display-string)))
-  (setq global-mode-string (delq 'enwc-display-string global-mode-string)))
-(setq enwc-display-mode-line new)))
+  (if (not enwc-display-mode-line)
+  (enwc-enable-display-mode-line)
+(enwc-disable-display-mode-line)))
 
 (defun enwc-toggle-auto-scan ()
   "Toggles automatic scanning.
@@ -967,8 +986,7 @@ and redisplays the settings from the network profile
(cons (cons (car x)
(widget-field-value-get (widget-at)))
  nil)
-(print settings)
-
+;;(print settings)
 (enwc-save-nw-settings enwc-using-wired enwc-edit-id settings)))
 
 (defun enwc-edit-entry-at-point ()



[elpa] master 18e4a3a 06/76: Updated copyright notices.

2017-02-23 Thread Ian Dunn
branch: master
commit 18e4a3ae4ded4aba8af7324adfce4f3367d73117
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

Updated copyright notices.
---
 Makefile   | 2 +-
 doc/enwc.texi  | 2 +-
 lisp/enwc-nm.el| 2 +-
 lisp/enwc-setup.el | 2 +-
 lisp/enwc.el   | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 81495bf..55a555a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 # This is part of ENWC
 #
-#  Copyright (C) 2012 Ian Dunn.
+#  Copyright (C) 2012,2013,2014 Ian Dunn.
 #
 #  This program is free software: you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
diff --git a/doc/enwc.texi b/doc/enwc.texi
index cc1a40f..dddb66d 100644
--- a/doc/enwc.texi
+++ b/doc/enwc.texi
@@ -15,7 +15,7 @@
 @copying
 This manual is for ENWC, the Emacs Network Client.
 
-Copyright (C) 2012 Ian Dunn
+Copyright (C) 2012,2013,2014 Ian Dunn
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 790eaec..6e4e694 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -1,6 +1,6 @@
 ;;; enwc-nm.el - The NetworkManager backend to ENWC
 
-;; Copyright (C) 2012,2013 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 33a156c..66004f6 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -1,6 +1,6 @@
 ;; enwc-setup.el - Setup routines for ENWC
 
-;; Copyright (C) 2012,2013 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 1f786dc..0723aa6 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -1,6 +1,6 @@
 ;;; enwc.el --- The Emacs Network Client
 
-;; Copyright (C) 2012,2013 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm



[elpa] master 141ad1b 65/76: Fixed NetworkManager connection bug.

2017-02-23 Thread Ian Dunn
branch: master
commit 141ad1b565f24e421ef2df15f6bab048c1dcaf28
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed NetworkManager connection bug.

* enwc-nm.el (enwc-nm-wireless-connect): Connect using a connection object
  rather than an access point object.
---
 lisp/enwc-nm.el | 27 +++
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index b0b51f8..df42d1e 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -258,10 +258,29 @@ This gets the connection path from NW, and connects to 
it."
 (enwc-nm-wireless-connect nw)))
 
 (defun enwc-nm-wireless-connect (nw)
-  (enwc-nm-dbus-default-call-method "ActivateConnection"
-:object-path nw
-:object-path enwc-nm-wireless-dev
-:object-path nw))
+  (let ((ap-ssid (dbus-byte-array-to-string
+  (dbus-get-property :system
+ enwc-nm-dbus-service
+ nw
+ 
"org.freedesktop.NetworkManager.AccessPoint"
+ "Ssid")))
+(profile-table (make-hash-table :test #'equal)))
+;; Create a hash table of connections, indexed by ssid
+;; TODO: Store this somewhere else
+(dolist (conn (enwc-nm-list-connections))
+  (let ((settings (dbus-call-method :system
+enwc-nm-dbus-service
+conn
+
"org.freedesktop.NetworkManager.Settings.Connection"
+"GetSettings")))
+(map-put profile-table
+ (dbus-byte-array-to-string (caadr (assoc-string "ssid" (cadr 
(assoc-string "802-11-wireless" settings)
+ conn)))
+(when-let (conn (map-elt profile-table ap-ssid))
+  (enwc-nm-dbus-default-call-method "ActivateConnection"
+:object-path conn
+:object-path enwc-nm-wireless-dev
+:object-path conn
 
 (defun enwc-nm-wired-connect (nw)
   (enwc-nm-dbus-default-call-method "ActivateConnection"



[elpa] master 17f27c6 18/76: (enwc-nm-prop-to-prop, enwc-nm-get-sec-types): Removed.

2017-02-23 Thread Ian Dunn
branch: master
commit 17f27c6e05d64cf7919a29ea01539af360036b7a
Author: Ian D 
Commit: Ian D 

(enwc-nm-prop-to-prop, enwc-nm-get-sec-types): Removed.
(enwc-nm-get-conn-by-nid, enwc-nm-get-conn-by-id): Removed.
(enwc-nm-get-uuid-by-id, enwc-nm-get-conn-by-uuid): Removed.
(enwc-nm-get-uuid-by-ssid): Removed.
(enwc-nm-string-idx): Cleaned up code.
(enwc-nm-get-dbus-dict-entry, enwc-nm-set-dbus-dict-entry): Added to assist 
with D-Bus conversion.
(enwc-nm-convert-dict-list, enwc-nm-pair-to-dbus-dict-ent): Same.
(enwc-nm-alist-to-dbus-dict, enwc-nm-alist-to-dubs-str-str-var-map-map): 
Same.
(enwc-nm-get-profile-info): Consolidated code.
(enwc-nm-get-ip-addr, enwc-nm-get-netmask, enwc-nm-get-gateway, 
enwc-nm-get-dns): Removed.
(enwc-nm-process-enc-type): Removed.
(enwc-nm-get-sec-info): Retrieve security information for the front-end.
(enwc-nm-process-profile-info): Convert profile information from the 
front-end.
(enwc-nm-finalize-settings): Consolidated code.
(enwc-nm-setup-settings): Consolidated code.
(enwc-nm-save-nw-settings): Updated to match new interface.
---
 lisp/enwc-nm.el | 428 +---
 1 file changed, 127 insertions(+), 301 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 278d1a0..fd882d3 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -227,12 +227,11 @@ ID is a string that NetworkManager uses to identify this 
network."
   (setq cur-conn (pop conns))
   (let ((settings (enwc-nm-get-settings cur-conn))
 conn-set)
-(if (not (assoc "connection" settings))
-nil
+(when (assoc "connection" settings)
   (setq conn-set (assoc "connection" settings))
   (setq cur-id (car (cadr (assoc "id" (cadr conn-set)
-  (if (string= cur-id id)
-  (setq uuid (car (cadr (assoc "uuid" (cadr conn-set)))
+  (when (string= cur-id id)
+(setq uuid (car (cadr (assoc "uuid" (cadr conn-set)))
 
 (defun enwc-nm-get-conn-by-uuid (uuid)
   (enwc-nm-dbus-settings-call-method "GetConnectionByUuid"
@@ -243,9 +242,8 @@ ID is a string that NetworkManager uses to identify this 
network."
 (defun enwc-nm-get-conn-by-ssid (ssid)
   "Gets the connection path for the access point with ssid SSID."
   (let ((uuid (enwc-nm-get-uuid-by-ssid ssid)))
-(if uuid
-(enwc-nm-get-conn-by-uuid uuid)
-  nil)))
+(when uuid
+  (enwc-nm-get-conn-by-uuid uuid
 
 ;; Not used.
 (defun enwc-nm-get-conn-by-id (id)
@@ -335,15 +333,7 @@ This gets the connection path from NW, and connects to it."
  enwc-nm-dbus-wireless-interface)))
 (enwc-nm-dbus-call-method "RequestScan"
   dev interface
-  '(:array :signature "{sv}"))
-;; (dbus-call-method :system
-;;   enwc-nm-dbus-service
-;;   dev
-;;   interface
-;;   "RequestScan"
-;;   :timeout 25000
-;;   '(:array :signature "{sv}"))
-))
+  '(:array :signature "{sv}"
 
 ;;;
 ;; Get network properties
@@ -361,16 +351,6 @@ PROP from that access point.  It also sets the channel 
from the
  enwc-nm-dbus-accesspoint-interface
  prop))
 
-(defun enwc-nm-prop-to-prop (prop)
-  "Converts a NetworkManager property to an ENWC network property."
-  (pcase prop
-("Ssid" 'essid)
-("HwAddres" 'bssid)
-("Strength" 'strength)
-("Flags" 'encrypt)
-("Mode" 'mode)
-("Channel" 'channel)))
-
 (defun enwc-nm--freq-to-channel (freq)
   "Convert a frequency FREQ into a channel."
   (1+ (/ (- freq 2412) 5)))
@@ -389,14 +369,6 @@ PROP from that access point.  It also sets the channel 
from the
   (channel  . ,(number-to-string (enwc-nm--freq-to-channel
   (cdr (assoc "Frequency" props
 
-(defun enwc-nm-get-conn-by-nid (nid)
-  "Gets a connection object with the network id NID."
-  (let* ((ssid (enwc-nm-get-wireless-network-property nid
-  "Ssid"))
- (uuid (enwc-nm-get-uuid-by-ssid ssid)))
-(when uuid
-  (enwc-nm-get-conn-by-uuid uuid
-
 (defun enwc-nm-get-encryption-type (nw)
   "The NetworkManager get encryption type function.
 This gets the WPA flags and RSN flags from access point in NW.
@@ -413,10 +385,8 @@ If both are 0, then it returns WEP, otherwise WPA."
 
 (defun enwc-nm-string-idx (obj ls)
   "Determine the index of string OBJ in LIST."
-  (unless (stringp obj)
-(signal 'wrong-type-argument `(stringp ,obj)))
-  (unless (listp ls)
-(signal 'wrong-type-argument `(listp ,ls)))
+  (cl-check-type obj string)
+  (cl-check-type ls list)
   (let ((tmp-list ls)
 (cur-pos -1)

[elpa] master 2e07c3a 54/76: Began work on WPA backend. EXPERIMENTAL!

2017-02-23 Thread Ian Dunn
branch: master
commit 2e07c3a8192c6edf565725818d37e938c0126948
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Began work on WPA backend.  EXPERIMENTAL!
---
 lisp/enwc-wpa.el | 76 
 1 file changed, 76 insertions(+)

diff --git a/lisp/enwc-wpa.el b/lisp/enwc-wpa.el
new file mode 100644
index 000..191ae71
--- /dev/null
+++ b/lisp/enwc-wpa.el
@@ -0,0 +1,76 @@
+;;; enwc-wpa.el --- Emacs Network Client WPA_CLI backend
+
+;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+;;
+;; Back-end driven by wpa_cli
+;;
+;; Requires root to use wpa_cli
+
+;;; Code:
+
+(require 'enwc)
+
+(defgroup enwc-wpa nil
+  "Settings for wpa_cli back-end."
+  :prefix "enwc-wpa-"
+  :group 'enwc)
+
+(defcustom enwc-wpa-wpa-cli-program "/usr/bin/wpa_cli"
+  "Name of the wpa_cli executable."
+  :group 'enwc-wpa
+  :type 'file)
+
+(defvar enwc-wpa--wpa-cli-buffer " *ENWC wpa_cli*")
+
+;; (defun enwc-wpa--run-wpa-cli ( args)
+;;   ;; Allow us to go into root.
+;;   (cd "/sudo::/")
+;;   (setq args (append
+;;   (list "-i" (if enwc-using-wired enwc-wired-device 
enwc-wireless-device))
+;;   args))
+;;   (apply #'call-process "wpa_cli" nil enwc-wpa--wpa-cli-buffer nil args))
+
+
+;; Load/Unload
+
+(defun enwc-wpa-load ()
+  ;; Start the wpa_cli process
+  ;; Start the wpa_supplicant process if necessary
+)
+
+
+; ;; ;
+; ;; Scan ;; ;
+; ;; ;
+
+(defun enwc-wpa-scan ()
+  "Run wpa_cli to get a scan"
+  (enwc-wpa--run-wpa-cli "scan")
+  ()
+  )
+
+;;; enwc-wpa.el ends here



[elpa] master e5c36d3 26/76: (enwc-nm-details-list): Removed.

2017-02-23 Thread Ian Dunn
branch: master
commit e5c36d3081079ccc8a54be5a2b445ae490aaeebd
Author: Ian D 
Commit: Ian D 

(enwc-nm-details-list): Removed.
(enwc-nm-get-settings): Implemented `enwc-nm-dbus-call-method'.
(enwc-nm-get-wired-profiles): Fixed to find correct profiles.
(enwc-nm-string-idx): Removed.
(enwc-nm-prop-changed): Improved docstring.
(enwc-nm-gen-uuid): Cleaned up code.
(enwc-nm-convert-addr, enwc-nm-addr-back): Added type checking.
(enwc-nm-netmask-to-prefix, enwc-nm-prefix-to-netmask): Implemented 
`enwc--htonl'.
(enwc-nm-get-dbus-dict-entry, enwc-nm-set-dbus-dict-entry): Added type 
checking.
---
 lisp/enwc-nm.el | 81 +
 1 file changed, 29 insertions(+), 52 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index feff840..b349a80 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -90,10 +90,6 @@
   :group 'enwc-nm
   :type 'string)
 
-(defvar enwc-nm-details-list
-  '("Ssid" "HwAddress" "Strength" "Flags" "Mode" "Frequency")
-  "The list of the desired details to be obtained from each network.")
-
 (defvar enwc-nm-wired-dev nil
   "The wired device object path.")
 
@@ -150,12 +146,8 @@
 (defun enwc-nm-get-settings (conn)
   "Gets the connection settings.
 CONN is an object path to the connection."
-  (dbus-call-method :system
-enwc-nm-dbus-service
-conn
-enwc-nm-dbus-connections-interface
-"GetSettings"
-:timeout 25000))
+  (enwc-nm-dbus-call-method "GetSettings" conn
+enwc-nm-dbus-connections-interface))
 
 (defun enwc-nm-list-connections ()
   "List the connections."
@@ -184,8 +176,9 @@ This returns a list of D-Bus paths to the access points."
 (mapcar
  (lambda (x)
(let ((props (enwc-nm-get-settings x)))
- (when (string= (caar props) "connection")
-   (car (cadr (car (cadr (car props
+ (when (string= (enwc-nm-get-dbus-dict-entry "connection/type" props)
+"802-3-ethernet")
+   (enwc-nm-get-dbus-dict-entry "connection/id" props
  profs-list)))
 
 ;
@@ -296,20 +289,6 @@ If both are 0, then it returns WEP, otherwise WPA."
 ;; Get Current network id
 ;;;
 
-(defun enwc-nm-string-idx (obj ls)
-  "Determine the index of string OBJ in LIST."
-  (cl-check-type obj string)
-  (cl-check-type ls list)
-  (let ((tmp-list ls)
-(cur-pos -1)
-cur-obj)
-(while (and (not cur-obj) tmp-list)
-  (setq cur-obj (pop tmp-list))
-  (setq cur-pos (1+ cur-pos))
-  (unless (string= obj cur-obj)
-(setq cur-obj nil)))
-cur-pos))
-
 (defun enwc-nm-wireless-prop-changed (props)
   "Called when network properties are changed.
 PROPS is a list of updated properties."
@@ -327,7 +306,9 @@ This simply checks for the active access point."
 
 (defun enwc-nm-prop-changed (state)
   "Called when NetworkManager's state is changed.
-STATE is the new state."
+STATE is the new state
+
+If STATE is 40, then NetworkManager is connecting to a new AP."
   (setq enwc-nm-connecting-p (eq state 40)))
 
 ;;
@@ -352,12 +333,11 @@ STATE is the new state."
 (defun enwc-nm-gen-uuid ()
   "Generate a UUID."
   (random t)
-  (let ((hex-nums
+  (apply 'format
+ "%04x%04x-%04x-%04x-%04x-%04x%04x%04x"
  (mapcar (lambda (x)
(random 65535))
- (number-sequence 0 7)))
-fin-str)
-(setq fin-str (apply 'format "%04x%04x-%04x-%04x-%04x-%04x%04x%04x" 
hex-nums
+ (number-sequence 0 7
 
 (defmacro enwc-nm--hex-substring (str st ed)
   "Get a standard integer from hex string STR starting at ST and ending st ED"
@@ -365,7 +345,7 @@ STATE is the new state."
 
 (defun enwc-nm-convert-addr (addr)
   "Convert an address ADDR from an integer in network byte order to a string."
-  (if addr
+  (if (and addr (integerp addr))
   (let* ((hex-addr (format "%08x" addr))
  (subs (mapcar
 (lambda (n)
@@ -376,6 +356,7 @@ STATE is the new state."
 
 (defun enwc-nm-addr-back (addr)
   "Convert an IP address ADDR in dots notation to an integer."
+  (cl-check-type addr string)
   (let* ((bytes (split-string addr "\\."))
  (byte-string (mapcar
(lambda (n) (lsh (string-to-number (nth n bytes))
@@ -388,36 +369,30 @@ STATE is the new state."
 (defun enwc-nm-netmask-to-prefix (netmask)
   "Converts a netmask to a CIDR prefix.
 NETMASK is an ip address in network byte order."
-  (if netmask
-  (let* ((mask netmask)
- (cur-pos 3)
- (cur-mark (logand (lsh mask (* -8 cur-pos)) 255))
- (pf 0))
-(while (and (eq cur-mark 255) (>= cur-pos 0))
-  (setq pf (+ pf 8))
-  (setq cur-pos (1- cur-pos))
-  (setq cur-mark (logand (lsh mask (* -8 cur-pos)) 

[elpa] master b673e3a 63/76: Added default setup and removed experimental WPA supplicant backend.

2017-02-23 Thread Ian Dunn
branch: master
commit b673e3a1991257483e0d0185537e0da19e93a1dc
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Added default setup and removed experimental WPA supplicant backend.
---
 lisp/enwc-setup.el | 59 ++
 lisp/enwc-wpa.el   | 76 --
 2 files changed, 59 insertions(+), 76 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
new file mode 100644
index 000..5c463c7
--- /dev/null
+++ b/lisp/enwc-setup.el
@@ -0,0 +1,59 @@
+;; enwc-setup.el - Setup routines for ENWC
+
+;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'enwc)
+(require 'enwc-backend)
+(require 'enwc-wicd)
+(require 'enwc-nm)
+
+;;;###autoload
+(defun enwc-setup ()
+  "Set up ENWC.
+This sets up ENWC and confirms that one of the backends can be found on D-Bus."
+  (when enwc-display-mode-line
+(enwc-enable-display-mode-line))
+
+  (when (and enwc-auto-scan
+ (> enwc-auto-scan-interval 0)
+ (not enwc-scan-timer))
+(setq enwc-scan-timer
+  (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
+
+  (let ((back-list enwc-backends)
+cur-back pass)
+(while (and back-list (not pass))
+  (setq cur-back (pop back-list))
+  (setq pass (ignore-errors (enwc-load-backend cur-back
+(unless pass
+  (error "No usable backend was found."
+
+(provide 'enwc-setup)
+
+;;; enwc-setup.el ends here
diff --git a/lisp/enwc-wpa.el b/lisp/enwc-wpa.el
deleted file mode 100644
index 191ae71..000
--- a/lisp/enwc-wpa.el
+++ /dev/null
@@ -1,76 +0,0 @@
-;;; enwc-wpa.el --- Emacs Network Client WPA_CLI backend
-
-;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
-
-;; Author: Ian Dunn <du...@gnu.org>
-;; Keywords: external, network, wicd, manager, nm
-;; Version: 2.0
-;; Homepage: https://savannah.nongnu.org/p/enwc
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software; you can redistribute it and/or modify it
-;; under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
-;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-;; License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
-;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-;; 02110-1301, USA.
-
-;;; Commentary:
-;;
-;; Back-end driven by wpa_cli
-;;
-;; Requires root to use wpa_cli
-
-;;; Code:
-
-(require 'enwc)
-
-(defgroup enwc-wpa nil
-  "Settings for wpa_cli back-end."
-  :prefix "enwc-wpa-"
-  :group 'enwc)
-
-(defcustom enwc-wpa-wpa-cli-program "/usr/bin/wpa_cli"
-  "Name of the wpa_cli executable."
-  :group 'enwc-wpa
-  :type 'file)
-
-(defvar enwc-wpa--wpa-cli-buffer " *ENWC wpa_cli*")
-
-;; (defun enwc-wpa--run-wpa-cli ( args)
-;;   ;; Allow us to go into root.
-;;   (cd "/sudo::/")
-;;   (setq args (append
-;;   (list "-i" (if enwc-using-wired enwc-wired-device 
enwc-wireless-device))
-;;   args))
-;;   (apply #'call-process "wpa_cli" nil enwc-wpa--wpa-cli-buffer nil args))
-
-
-;; Load/Unload
-
-(defun enwc-wpa-load ()
-  ;; Start the wpa_cli process
-  ;; Start the wpa_supplicant process if necessary
-)
-
-
-; ;; ;
-; ;; Scan ;; ;
-; ;; ;
-
-(defun enwc-wpa-scan ()
-  "Run wpa_cli to get a scan"
-  (enwc-wpa--run-wpa-cli "scan")
-  ()
-  )
-
-;;; enwc-wpa.el ends here



[elpa] master 8f08bcb 58/76: Cleaned up network display.

2017-02-23 Thread Ian Dunn
branch: master
commit 8f08bcb148267da954b0e3421b0da2c74fdd22f7
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Cleaned up network display.

* enwc.el (enwc-details-list): Cleaned up.
  (enwc-column-spec): Implemented sorters for channel and strength.
  (enwc--update-scan-results, enwc-redisplay-wireless-networks): New 
functions.
  (enwc-process-scan): Use `enwc--update-scan-results'.
  Pop to ENWC buffer if running an interactive scan.
  (enwc-display-wireless-networks): Use new sorters.
  (enwc-mode): Use `enwc-redisplay-wireless-networks' for revert instead of
  scan.
---
 lisp/enwc.el | 88 +++-
 1 file changed, 64 insertions(+), 24 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 8a5e89a..ddd420e 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -5,6 +5,7 @@
 ;; Author: Ian Dunn <du...@gnu.org>
 ;; Keywords: external, network, wicd, manager, nm
 ;; Version: 2.0
+;; Package-Requires: ((emacs "25.1"))
 ;; Homepage: https://savannah.nongnu.org/p/enwc
 
 ;; This file is part of GNU Emacs.
@@ -34,14 +35,17 @@
 ;;
 ;; In order to use this package, add
 ;;
-;; (require 'enwc-setup)
-;; (enwc-setup)
+;; (require 'enwc)
+;; (enwc-load-default-backend)
 ;;
 ;; to your .emacs file (or other init file).
 
 ;;; TODO:
 ;;
 ;; - Add hooks for scan completion, and possibly upon network connection.
+;; - Wired uses profiles, not networks; Refer to them as such
+;; - Is an association list the best idea for scan results?  Perhaps a 
structure
+;;   would work better?
 
 ;;; Code:
 
@@ -118,18 +122,47 @@ in `enwc-update-mode-line'.")
   "Convert signal strength S to a string to dispay."
   (format "%s%%" s))
 
+(defmacro enwc--make-number-sorter (n)
+  `(lambda (a b)
+ (let ((act-a (aref (nth 1 a) ,n))
+   (act-b (aref (nth 1 b) ,n)))
+   (< act-a act-b
+
+(defalias 'enwc--str-sorter (enwc--make-number-sorter 0))
+(defalias 'enwc--chnl-sorter (enwc--make-number-sorter 4))
+
 (cl-defstruct enwc-column-spec ()
-  detail display width conv)
+  detail display sorter width conv)
 
-(defvar enwc-details-list
+(defconst enwc-details-list
   (list
-   (make-enwc-column-spec :detail 'strength :display "Str" :conv 
#'enwc--print-strength)
-   (make-enwc-column-spec :detail 'essid:display "Essid"   :conv 
#'identity)
-   (make-enwc-column-spec :detail 'encrypt  :display "Encrypt" :conv 
#'identity)
-   (make-enwc-column-spec :detail 'bssid:display "Bssid"   :conv 
#'identity)
-   (make-enwc-column-spec :detail 'channel  :display "Channel" :conv 
#'identity)))
-
-(defvar enwc-last-scan nil
+   (make-enwc-column-spec
+:detail 'strength
+:display "Str"
+:sorter #'enwc--str-sorter
+:conv #'enwc--print-strength)
+   (make-enwc-column-spec
+:detail 'essid
+:display "Essid"
+:sorter t
+:conv #'identity)
+   (make-enwc-column-spec
+:detail 'encrypt
+:display "Encrypt"
+:sorter t
+:conv #'identity)
+   (make-enwc-column-spec
+:detail 'bssid
+:display "Bssid"
+:sorter t
+:conv #'identity)
+   (make-enwc-column-spec
+:detail 'channel
+:display "Channel"
+:sorter #'enwc--chnl-sorter
+:conv #'number-to-string)))
+
+(defvar enwc-last-scan (make-hash-table :test #'equal)
   "The most recent scan results.
 
 This will be an association list of the form:
@@ -404,23 +437,29 @@ This checks whether or not wired is being used, and runs 
the appropriate
   (enwc-scan-internal-wired)
 (enwc-scan-internal-wireless)))
 
+(defun enwc--update-scan-results ()
+  (setq enwc-last-scan (make-hash-table :test #'equal))
+  (dolist (ap (enwc-get-networks))
+(puthash ap (enwc-get-wireless-nw-props ap) enwc-last-scan)))
+
+(defun enwc-redisplay-wireless-networks ()
+  (interactive)
+  (enwc--update-scan-results)
+  (enwc-display-wireless-networks enwc-last-scan))
+
 (defun enwc-process-scan ( args)
   "The scanning callback.
 After a scan has been performed, this processes and displays the scan results.
 
 ARGS is only for compatibility with the calling function."
   (unless (or enwc-using-wired (not enwc-scan-requested))
-(setq enwc-scan-requested nil
-  enwc-access-points  (enwc-get-networks))
+(setq enwc-scan-requested nil)
 (when enwc-scan-interactive
   (message "Scanning... Done"))
-(setq enwc-last-scan (map-into
-  (mapcar
-   (lambda (ap)
- `(,ap . ,(enwc-get-wireless-nw-props ap)))
-   enwc-access-points)
-  'hash-table))
+(enwc--update-scan-results)
 (enwc-display-wireless-networks enwc-last-scan)
+(when enwc-scan-interactive
+  (pop-to-buffer "*ENWC*"))
   

[elpa] master 4e0d5a2 41/76: Cosmetic changes.

2017-02-23 Thread Ian Dunn
branch: master
commit 4e0d5a259daed33ce1574ade293e5c7088b65f4f
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Cosmetic changes.
---
 lisp/enwc-nm.el | 4 ++--
 lisp/enwc.el| 8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 790eaec..e7dc5a3 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -157,7 +157,7 @@ CONN is an object path to the connection."
enwc-nm-dbus-connections-interface
"GetSettings"
:timeout 25000))
-  
+
 
 (defun enwc-nm-list-connections ()
   "List the connections."
@@ -601,7 +601,7 @@ PREFIX is an integer <= 32."
 (logand (lsh hex-addr -8) 255)
 (logand (lsh hex-addr -16) 255)
 (logand (lsh hex-addr -24) 255))
-
+
 
 (defun enwc-nm-get-gateway (wired id)
   "Gets the Gateway of a connection profile."
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 825cb5f..83aa6d6 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2012,2013 Free Software Foundation
 
 ;; Author: Ian Dunn
-;; Keywords: enwc, network, wicd, manager, nm
+;; Keywords: external, network, wicd, manager, nm
 
 ;; This file is part of ENWC
 
@@ -36,7 +36,7 @@
 ;;
 ;; (require 'enwc-setup)
 ;; (enwc-setup)
-;; 
+;;
 ;; to your .emacs file.
 
 (require 'dbus)
@@ -51,7 +51,7 @@
 (defgroup enwc nil
   "*The Emacs Network Client"
   :prefix "ewnc-"
-  :group 'applications)
+  :group 'external)
 
 (defcustom enwc-wireless-device "wlan0"
   "The wireless device to use for ENWC."
@@ -602,7 +602,7 @@ the ENWC buffer if necessary, and scans and displays the 
networks."
  (goto-char 0)
  (forward-line))
  (enwc-scan-internal)
-  
+
 (defun enwc-find-network (essid  networks)
   "Checks through NETWORKS for the network with essid ESSID,
 and returns the network identifier.  Uses `enwc-last-scan' if



[elpa] master e8b1d77 05/76: * enwc.el (enwc-display-mode-line-timer): Added a variable for the mode line timer.

2017-02-23 Thread Ian Dunn
branch: master
commit e8b1d77f4940804f97a7d8cbc865bca86c25090a
Author: Ian D 
Commit: Ian D 

* enwc.el (enwc-display-mode-line-timer): Added a variable for the mode 
line timer.
(enwc-scan-timer, enwc-auto-scan, enwc-auto-scan-interval, 
enwc-toggle-auto-scan):  Added support for automatic scans.
(enwc-scan-internal-wireless, enwc-process-scan): Only displays scanning 
message when interactive.

* enwc-setup.el (enwc-setup): Initializes the timers for mode line display 
and automatic scanning.
---
 lisp/enwc-setup.el | 10 +++---
 lisp/enwc.el   | 35 +--
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index fddcd08..33a156c 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -89,8 +89,7 @@
"-get-nw-info"))
  enwc-save-nw-settings-func (intern (concat "enwc-"
 sym-name
-"-save-nw-settings"))
- )
+"-save-nw-settings")))
 (funcall (intern (concat "enwc-" sym-name "-setup")
 
 (defun enwc-setup ()
@@ -100,7 +99,12 @@ on D-Bus."
   (if enwc-display-mode-line
   (setq global-mode-string (append global-mode-string
'(enwc-display-string
-  (run-at-time t 1 'enwc-update-mode-line)
+  (setq enwc-display-mode-line-timer 
+(run-at-time t 1 'enwc-update-mode-line))
+
+  (if (and enwc-auto-scan (> enwc-auto-scan-interval 0))
+  (setq enwc-scan-timer
+(run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
 
   (let ((cur-back nil)
(back-list enwc-backends))
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 8436c79..1f786dc 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -78,6 +78,18 @@ Emacs mode line."
   :group 'enwc
   :type 'boolean)
 
+(defcustom enwc-auto-scan 't
+  "Whether or not to have ENWC automatically scan.
+If non-nil, then ENWC will automatically scan for
+networks every `enwc-auto-scan-interval' seconds."
+  :group 'enwc
+  :type 'boolean)
+
+(defcustom enwc-auto-scan-interval 20
+  "The interval between automatic scans."
+  :group 'enwc
+  :type 'integer)
+
 ;;; The function variables for the abstract layer.
 
 (defvar enwc-scan-func nil
@@ -245,6 +257,12 @@ This is used so as to avoid multiple updates of the scan 
data.")
   "Indicates that a scan was interactively requested.
 This is only used internally.")
 
+(defvar enwc-display-mode-line-timer nil
+  "The timer that updates the mode line display.")
+
+(defvar enwc-scan-timer nil
+  "The timer for automatic scanning.")
+
 (make-local-variable 'enwc-edit-id)
 ;; The Fonts
 
@@ -448,6 +466,17 @@ This is initiated during setup, and runs once every 
second."
   (setq global-mode-string (delq 'enwc-display-string global-mode-string)))
 (setq enwc-display-mode-line new)))
 
+(defun enwc-toggle-auto-scan ()
+  "Toggles automatic scanning.
+This will use the current value of `enwc-auto-scan-interval'."
+  (interactive)
+  (let ((new (not enwc-auto-scan)))
+(if new
+(setq enwc-scan-timer
+  (run-at-time t enwc-auto-scan-interval 'enwc-scan t))
+  (cancel-timer enwc-scan-timer))
+(setq enwc-auto-scan new)))
+
 ;;
 ;; Scan internal
 ;;
@@ -456,7 +485,8 @@ This is initiated during setup, and runs once every second."
   "The initial scan routine.
 This initiates a scan using D-Bus, then exits,
 waiting for the callback."
-  (message "Scanning...")
+  (if enwc-scan-interactive
+  (message "Scanning..."))
   (setq enwc-scan-requested t)
   (setq enwc-scan-done nil)
   (enwc-do-scan))
@@ -470,7 +500,8 @@ the scan results."
 (setq enwc-scan-requested nil)
 (let ((cur-id 0)
  (nw-prop-list nil))
-  (message "Scanning... Done")
+  (if enwc-scan-interactive
+  (message "Scanning... Done"))
   (setq enwc-access-points (enwc-get-nw)
enwc-essid-width 5)
   (setq nw-prop-list



[elpa] master updated (b30addd -> da7e3c6)

2017-02-23 Thread Ian Dunn
skolar42 pushed a change to branch master.

  from  b30addd   * windresize.el: Fix up email; address compiler warnings
   new  710001f   Removed packages/enwc in preparation for subtree pull.
   new  2ebc214   Changed timeout on 
enwc-wicd-get-wireless-network-property.
   new  d6aa3ee   Fixed up enwc-wicd network properties.
   new  5088938   Removed erroneous comment.
   new  4e0d5a2   Cosmetic changes.
   new  ec0539b   Fixed enwc-setup to be able to be called more than once.
   new  6ed7137   Fix adding to global-mode-string.
   new  c9a94c8   Added tag 2.0 for changeset 3e2cab525cbc
   new  8f21449   Removed tag 2.0
   new  968e6f0   Added tag 2.0 for changeset cc2f7aa4ed36
   new  c6585bb   Added autoloads
   new  5c63470   Fixed autoloads generation and added hgignore.
   new  7a3c057   Added support for toggling the mode line display.
   new  b5e612f   * enwc.el (enwc-display-networks, 
enwc-maybe-pretty-entry): Added support for colorizing the current network. 
(enwc-scan): Set up to allow the networks to be updated without the buffer 
being displayed.
   new  e8b1d77   * enwc.el (enwc-display-mode-line-timer): Added a 
variable for the mode line timer. (enwc-scan-timer, enwc-auto-scan, 
enwc-auto-scan-interval, enwc-toggle-auto-scan):  Added support for automatic 
scans. (enwc-scan-internal-wireless, enwc-process-scan): Only displays scanning 
message when interactive.
   new  18e4a3a   Updated copyright notices.
   new  4a3acfc   * enwc.el (enwc-enable-display-mode-line, 
enwc-disable-display-mode-line, enwc-toggle-display-mode-line): Broke 
enable/disable mode line functionality into different functions.
   new  89f9418   enwc.el (enwc-display-wireless-networks): Removed old 
comment.
   new  0d92006   (enwc-update-mode-line): Forces the mode line to update 
when ENWC updates its current signal.
   new  7914c48   (enwc-format-mode-line-string, enwc-update-mode-line): 
Added the option to customize the information displayed in the mode line.
   new  eb6b085   Fixed up copyright information. 
(enwc-format-mode-line-string): Set up to handle invalid and connecting 
networks.
   new  f77237c   (enwc-format-mode-line-string): Checks to confirm that 
scan data exists.
   new  cb32122   (enwc-nm-prop-to-prop, enwc-wicd-prop-to-prop): Convert 
the properties used internally to the property names used externally. 
(enwc-nm-get-wireless-nw-props, enwc-wicd-build-prop-list): Uses the external 
property names for the returned assocative list. 
(enwc-nm-get-wireless-nw-props, enwc-wicd-get-wireless-nw-props): Get the 
encryption type in the back-ends instead of the front-end. 
(enwc-setup-backend): No longer initializes enwc-details-list. 
(enwc-wicd-get-current [...]
   new  3491895   Cleaned up code and consolidated front-end functions.
   new  942d83d   enwc.el, enwc-setup.el: Consolidated and concretely 
defined front-end interface. enwc-wicd.el, enwc-nm.el: Cleaned up code to fit 
front-end (excluding security) enwc-cm.el: Added more to the back-end 
definition.
   new  d091e21   (enwc-get-profile-sec-info): Removed.
   new  b5686da   (enwc-wicd-get-sec-types): Removed. 
(enwc-wicd-get-profile-info, enwc-wicd-get-profile-sec-info): Updated to match 
the new interface.
   new  17f27c6   (enwc-nm-prop-to-prop, enwc-nm-get-sec-types): Removed. 
(enwc-nm-get-conn-by-nid, enwc-nm-get-conn-by-id): Removed. 
(enwc-nm-get-uuid-by-id, enwc-nm-get-conn-by-uuid): Removed. 
(enwc-nm-get-uuid-by-ssid): Removed. (enwc-nm-string-idx): Cleaned up code. 
(enwc-nm-get-dbus-dict-entry, enwc-nm-set-dbus-dict-entry): Added to assist 
with D-Bus conversion. (enwc-nm-convert-dict-list, 
enwc-nm-pair-to-dbus-dict-ent): Same. (enwc-nm-alist-to-dbus-dict, 
enwc-nm-alist-to-dubs-st [...]
   new  742b67a   Removed several network manager functions.
   new  59ca546   (enwc--str-to-sym): Fixed. (enwc-profile-props-widget): 
Added indentation. (enwc--make-supplicant-multi): Added indentation. 
(enwc--make-supplicant-choice): Added indentation and fixed button. 
(enwc--make-supplicant-list): Added indentation. (enwc-supplicant-alist): Added 
default parameters for phase lists. (enwc-supplicant-template-alist): Fixed 
default parameters for phase lists. (enwc--get-supplicant-entry): Fixed 
initialization values for lists. (enwc-create-temp [...]
   new  ca50c21   (enwc--int-to-byte-list, enwc--byte-list-to-int, 
enwc--htonl): Added to assist with D-Bus conversion. (enwc-nm-sec-types): 
Removed. (enwc-nm-dbus-*-call-method): Used `apply' to pass the argumetnts to 
`enwc-nm-dbus-call-method'. (enwc-nm-gen-uuid): Added doc-string. 
(enwc-nm-convert-addr): Added doc-string. (enwc-nm-addr-back): Fixed bugs and 
added doc-string. (enwc-nm-netmask-to-prefix): Added doc-string. 
(enwc-nm-prefix-to-netmask): Fixed bugs and added doc-string. [...]
   new  20afe01   (enwc-wicd-save-nw-settings): Updated to work 

[elpa] master d091e21 16/76: (enwc-get-profile-sec-info): Removed.

2017-02-23 Thread Ian Dunn
branch: master
commit d091e21cdc518a76d1f21b7d62be0fb891edb13a
Author: Ian D 
Commit: Ian D 

(enwc-get-profile-sec-info): Removed.
---
 lisp/enwc.el | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 6c9d7b3..1ebca2f 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -319,13 +319,6 @@ This checks for an active wired connection."
 ID is specific to the backend."
   (funcall enwc-get-profile-info-func id enwc-using-wired))
 
-(defun enwc-get-profile-sec-info (id sec-type)
-  "Get the security info for the network ID.
-SEC-TYPE is the type of security for which to obtain the data.
-
-ID is specific to the backend."
-  (funcall enwc-get-profile-sec-info-func id sec-type enwc-using-wired))
-
 (defun enwc-save-nw-settings (id settings)
   "Saves network settings SETTINGS to the network profile with network id ID.
 SETTINGS is an association list with entries for the IP Address, Netmask,



[elpa] master b5e612f 04/76: * enwc.el (enwc-display-networks, enwc-maybe-pretty-entry): Added support for colorizing the current network.

2017-02-23 Thread Ian Dunn
branch: master
commit b5e612fdee6eeb67fd56988839d190708c00e7ef
Author: Ian D 
Commit: Ian D 

* enwc.el (enwc-display-networks, enwc-maybe-pretty-entry): Added support 
for colorizing the current network.
(enwc-scan): Set up to allow the networks to be updated without the buffer 
being displayed.
---
 lisp/enwc.el | 73 +---
 1 file changed, 40 insertions(+), 33 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index f851b62..8436c79 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -237,21 +237,25 @@ whether or not ENWC is in wired mode.")
 (defvar enwc-edit-id nil
   "This is the network id of the network being edited.")
 
-(defvar enwc-scan-requested nil)
+(defvar enwc-scan-requested nil
+  "Indicates that a scan has been requested.
+This is used so as to avoid multiple updates of the scan data.")
 
-(defvar enwc-scan-interactive nil)
+(defvar enwc-scan-interactive nil
+  "Indicates that a scan was interactively requested.
+This is only used internally.")
 
 (make-local-variable 'enwc-edit-id)
 ;; The Fonts
 
-(defface enwc-header-face
-  'class color) (background light))
- (:foreground "Blue"))
-(((class color) (background dark))
- (:foreground "Blue"))
-(t (:background "Blue")))
-  "The face for the headers."
-  :group 'enwc)
+;; (defface enwc-header-face
+;;   'class color) (background light))
+;;  (:foreground "Blue"))
+;; (((class color) (background dark))
+;;  (:foreground "Blue"))
+;; (t (:background "Blue")))
+;;   "The face for the headers."
+;;   :group 'enwc)
 
 (defface enwc-connected-face
   'class color) (background dark))
@@ -501,7 +505,8 @@ the scan results."
 (setq enwc-essid-width (1+ enwc-essid-width))
 (setq enwc-scan-done t)
 (if enwc-scan-interactive
- (enwc-display-wireless-networks enwc-last-scan
+(enwc-display-wireless-networks enwc-last-scan))
+(setq enwc-scan-interactive nil)))
 
 (defun enwc-scan-internal-wired ()
   "The scanning routine for a wired connection.
@@ -551,6 +556,12 @@ ENT is the entry, and WIDTH is the column width."
   (insert ent)
   (insert-char 32 (- width (length ent
 
+(defmacro enwc-maybe-pretty-entry (entry)
+  `(if (eq cur-id (cdr (assoc "id" nw)))
+   (propertize ,entry
+   'font-lock-face 'enwc-connected-face)
+ ,entry))
+
 (defun enwc-display-wireless-networks (networks)
   "Displays the networks in the list NETWORKS in the current buffer.
 NETWORKS must be in the format returned by
@@ -579,14 +590,15 @@ NETWORKS must be in the format returned by
entry)
(setq entry (list nil
  (vector
-  (number-to-string (cdr (assoc "id" nw)))
-   (concat (number-to-string (cdr (assoc "quality" 
nw)))
-  "%")
-   (cdr (assoc "essid" nw))
-  (cdr (assoc "encryption" nw))
-  (cdr (assoc "bssid" nw))
-  (cdr (assoc "mode" nw))
-  (cdr (assoc "channel" nw)
+  (enwc-maybe-pretty-entry (number-to-string (cdr 
(assoc "id" nw
+   (enwc-maybe-pretty-entry
+(concat (number-to-string (cdr (assoc "quality" 
nw)))
+"%"))
+   (enwc-maybe-pretty-entry (cdr (assoc "essid" nw)))
+  (enwc-maybe-pretty-entry (cdr (assoc "encryption" 
nw)))
+  (enwc-maybe-pretty-entry (cdr (assoc "bssid" nw)))
+  (enwc-maybe-pretty-entry (cdr (assoc "mode" nw)))
+  (enwc-maybe-pretty-entry (cdr (assoc "channel" 
nw))
(setq entries (cons entry entries
 
 (setq tabulated-list-entries (nreverse entries))
@@ -605,17 +617,19 @@ functions, and checks whether or not ENWC is using wired."
   (enwc-display-wired-networks networks)
 (enwc-display-wireless-networks networks)))
 
-(defun enwc-scan ()
+(defun enwc-scan ( nodisp)
   "The frontend of the scanning routine.  Sets up and moves to
-the ENWC buffer if necessary, and scans and displays the networks."
-  (interactive)
-  (setq enwc-scan-interactive t)
+the ENWC buffer if necessary, and scans and displays the networks.
+If NODISP is non-nil, then do not display the results in the ENWC
+buffer."
+  (interactive "p")
+  (if (not nodisp)
+  (setq enwc-scan-interactive t))
   (if (get-buffer "*ENWC*")
   (with-current-buffer "*ENWC*"
(if enwc-using-wired
(progn
  (enwc-scan-internal)
- ;;(enwc-display-networks enwc-last-scan)
  (goto-char 0)
  (forward-line))
  (enwc-scan-internal)
@@ -959,9 +973,7 @@ and redisplays the settings from the network profile
 

[elpa] master 01075fa 28/76: Fixed up docstrings.

2017-02-23 Thread Ian Dunn
branch: master
commit 01075fa97dcdfa574bf5fce4d24eae50c977ac1f
Author: Ian D 
Commit: Ian D 

Fixed up docstrings.
---
 lisp/enwc-wicd.el | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index 484aa67..a637696 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -111,7 +111,7 @@ Just returns a number sequence."
   (number-sequence 0 (1- (enwc-wicd-dbus-wireless-call-method 
"GetNumberOfNetworks"
 
 (defun enwc-wicd-get-wired-profiles ()
-  "Gets the list of wired network profiles."
+  "Get the list of wired network profiles."
   (enwc-wicd-dbus-wired-call-method "GetWiredProfileList"))
 
 
@@ -196,7 +196,7 @@ property from wireless network with id ID."
id "encryption_method"))
 
 (defun enwc-wicd-get-wired-nw-prop (id det)
-  "Gets property DET from the wired network with id ID."
+  "Get property DET from the wired network with id ID."
   (enwc-wicd-dbus-wired-call-method "GetWiredProperty" id det))
 
 ;;;
@@ -276,7 +276,7 @@ so this jut returns the tracked network id."
 ;
 
 (defun enwc-wicd-get-profile-ent (wired id ent)
-  "Gets profile entry ENT from the network with id ID.
+  "Get profile entry ENT from the network with id ID.
 WIRED is set to indicate whether this is a wired network.
 This function is a wrapper around the *-get-(wired|wireless)-nw-prop
 functions, allowing for a single function that checks for wired."
@@ -307,22 +307,22 @@ WIRED is set to indicate whether this is a wired network."
enwc-supplicant-alist))
 
 (defun enwc-wicd-get-ip-addr (wired id)
-  "Gets the IP Address from the network with id ID.
+  "Get the IP Address from the network with id ID.
 Wired is set to indicate whether this is a wired network."
   (or (enwc-wicd-get-profile-ent wired id "ip") ""))
 
 (defun enwc-wicd-get-netmask (wired id)
-  "Gets the Netmask from the network with id ID.
+  "Get the Netmask from the network with id ID.
 WIRED is set to indicate whether this is a wired network."
   (or (enwc-wicd-get-profile-ent wired id "netmask") ""))
 
 (defun enwc-wicd-get-gateway (wired id)
-  "Gets the Gateway from the network with id ID.
+  "Get the Gateway from the network with id ID.
 WIRED is set to indicate whether this is a wired network."
   (or (enwc-wicd-get-profile-ent wired id "gateway") ""))
 
 (defun enwc-wicd-get-dns (wired id)
-  "Gets the list of DNS servers from the network with id ID.
+  "Get the list of DNS servers from the network with id ID.
 WIRED is set to indicate whether this is a wired network."
   (list (or (enwc-wicd-get-profile-ent wired id "dns1") "")
 (or (enwc-wicd-get-profile-ent wired id "dns2") "")
@@ -333,7 +333,7 @@ WIRED is set to indicate whether this is a wired network."
 ;;;
 
 (defun enwc-wicd-set-nw-prop (wired id prop val)
-  "Sets the network property PROP of the network with id ID
+  "Set the network property PROP of the network with id ID
 to VAL.
 WIRED indicates whether this is a wired network."
   (if wired
@@ -360,7 +360,7 @@ for each entry in PHASE."
phase " "))
 
 (defun enwc-wicd-save-nw-settings (id settings  wired)
-  "Saves the settings indicated for network ID.
+  "Save the settings indicated for network ID.
 The association list SETTINGS contains the settings for the network.
 WIRED indicates whether or not ID is a wired connection."
   (dolist (setting settings)



[elpa] master 11443eb 34/76: enwc-setup.el: Fixed up header and footer.

2017-02-23 Thread Ian Dunn
branch: master
commit 11443eb73fc4d0312217bc4eeab5b2017b28cd3a
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

enwc-setup.el: Fixed up header and footer.
---
 lisp/enwc-setup.el | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 649eaef..746d297 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -1,27 +1,32 @@
 ;; enwc-setup.el - Setup routines for ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
 
-;; Author: Ian Dunn
-;; Keywords: enwc, network, wicd, manager, nm
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
 
-;; This file is part of ENWC
+;; This file is part of GNU Emacs.
 
-;; ENWC is free software; you can redistribute it and/or modify it
+;; GNU Emacs is free software; you can redistribute it and/or modify it
 ;; under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
-;; ENWC is distributed in the hope that it will be useful, but WITHOUT
+;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 ;; License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with ENWC; see the file COPYING.  If not, write to the Free
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 ;; 02110-1301, USA.
 
+;;; Commentary:
+
+;;; Code:
 
 (require 'enwc)
 (require 'enwc-wicd)
@@ -48,14 +53,14 @@
(intern (concat "enwc-" backend "-" func
 
 (defun enwc-setup-backend (cur-back)
-  "Sets up ENWC to use the correct function for the backend CUR-BACK."
+  "Set up ENWC to use the correct function for the backend CUR-BACK."
   (let* ((sym-name (symbol-name cur-back))
  (esb (apply-partially 'enwc--setq-backend sym-name)))
 (cl-mapc esb enwc-backend-symbol-list)
 (funcall (enwc--intern-sym sym-name "-setup"
 
 (defun enwc-setup ()
-  "Sets up ENWC.
+  "Set up ENWC.
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
   (when enwc-display-mode-line
@@ -80,4 +85,4 @@ on D-Bus."
 
 (provide 'enwc-setup)
 
-;;; End of File.
+;;; enwc-setup.el ends here



[elpa] master 20afe01 22/76: (enwc-wicd-save-nw-settings): Updated to work with new interface.

2017-02-23 Thread Ian Dunn
branch: master
commit 20afe01f3cd8d1a58f087f5825e687536952a098
Author: Ian D 
Commit: Ian D 

(enwc-wicd-save-nw-settings): Updated to work with new interface.
---
 lisp/enwc-wicd.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index bcfff67..fc895a6 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -361,19 +361,19 @@ WIRED indicates whether this is a wired network."
 (defun enwc-wicd-save-nw-settings (id settings  wired)
   "Saves the settings indicated by the association list SETTINGS for
 the network with id ID."
-  (let ((enctype (cdr (assoc "enctype" settings
+  (let ((enctype (alist-get 'enctype settings "")))
 
 (enwc-wicd-set-nw-prop wired id "ip"
-   (cdr (assoc "addr" settings)))
+   (alist-get 'addr settings ""))
 (enwc-wicd-set-nw-prop wired id "netmask"
-   (cdr (assoc "netmask" settings)))
+   (alist-get 'netmask settings ""))
 (enwc-wicd-set-nw-prop wired id "gateway"
-   (cdr (assoc "gateway" settings)))
+   (alist-get 'gateway settings ""))
 
 (enwc-wicd-set-nw-prop wired id "dns1"
-   (cdr (assoc "dns1" settings)))
+   (alist-get 'dns1 settings ""))
 (enwc-wicd-set-nw-prop wired id "dns2"
-   (cdr (assoc "dns2" settings)))
+   (alist-get 'dns2 settings ""))
 
 (enwc-wicd-set-nw-prop wired id "enctype" enctype)
 (if (not (string= enctype "None"))



[elpa] master 0d92006 09/76: (enwc-update-mode-line): Forces the mode line to update when ENWC updates its current signal.

2017-02-23 Thread Ian Dunn
branch: master
commit 0d92006d64b67c4d451ff6cb077d9355c984d4c0
Author: Ian D 
Commit: Ian D 

(enwc-update-mode-line): Forces the mode line to update when ENWC updates 
its current signal.
---
 lisp/enwc.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 2d6e455..aba6027 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -455,7 +455,9 @@ This is initiated during setup, and runs once every second."
  (if conn
  "*"
(number-to-string str))
- "%] "
+ "%] "))
+(force-mode-line-update)))
+
 (defun enwc-enable-display-mode-line ()
   "Enables the mode line display."
   (interactive)



[elpa] master 5c63470 48/76: Fixed autoloads generation and added hgignore.

2017-02-23 Thread Ian Dunn
branch: master
commit 5c63470887b07b728306744de7daa37cc5bba189
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed autoloads generation and added hgignore.
---
 .hgignore | 2 ++
 lisp/Makefile | 7 ---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.hgignore b/.hgignore
new file mode 100644
index 000..b905ccf
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,2 @@
+lisp/*.elc
+lisp/enwc-autoloads.el
\ No newline at end of file
diff --git a/lisp/Makefile b/lisp/Makefile
index 9e33203..0789624 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -17,7 +17,7 @@
 
 
 
-EMACS=emacs
+EMACS=emacs --batch
 ALLSRC=enwc.el enwc-wicd.el enwc-nm.el enwc-setup.el
 ALLELC=$(wildcard *.elc)
 EXPER=enwc-cm.el
@@ -27,13 +27,14 @@ TARGET=$(patsubst %.el,%.elc,$(SOURCE))
 all: $(TARGET)
 
 %.elc: %.el
-   @$(EMACS) -q --batch \
+   @$(EMACS) \
-L "." \
-f batch-byte-compile $<
 
 enwc-autoloads.el:
-   @$(EMACS) -q --batch \
+   @$(EMACS) \
--eval "(require 'package)" \
+   --eval "(setq inhibit-message t)" \
--eval "(package-generate-autoloads \"enwc\" \"$$(pwd)\")"
 
 clean:



[elpa] master 2ebc214 01/76: Changed timeout on enwc-wicd-get-wireless-network-property.

2017-02-23 Thread Ian Dunn
branch: master
commit 2ebc214ecbc3a0fef006b4ef1c0f3f8e1eafd29c
Author: Ian D 
Commit: Ian D 

Changed timeout on enwc-wicd-get-wireless-network-property.
---
 lisp/enwc-wicd.el | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
old mode 100755
new mode 100644
index e7388d2..0343648
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -98,6 +98,7 @@ the wicd wired interface."
 
 (defvar enwc-wicd-prop-values nil)
 (defvar enwc-wicd-prop-num 0)
+(defvar enwc-wicd-prop-timeout 3)
 
 (defun enwc-wicd-nw-prop-handler ( args)
   (setq enwc-wicd-prop-values (cons args enwc-wicd-prop-values))
@@ -113,11 +114,9 @@ from wireless network with id ID."
   enwc-wicd-dbus-wireless-interface
   "GetWirelessProperty"
   'enwc-wicd-nw-prop-handler
+   :timeout 1000
   :int32 id
-  :string prop)
-
-  ;;(enwc-wicd-dbus-wireless-call-method "GetWirelessProperty" id prop)
-  )
+  :string prop))
 
 (defun enwc-wicd-build-prop-list (prop-list det-list)
   (let (ret
@@ -136,8 +135,11 @@ from wireless network with id ID."
(enwc-wicd-get-wireless-network-property id x))
  enwc-wicd-details-list)
   ;; Wait for less than a second.
+  (with-timeout (enwc-wicd-prop-timeout)
+  (while (< enwc-wicd-prop-num 6)
+   (read-event nil nil 0.001)))
   (while (< enwc-wicd-prop-num 6)
-(read-event nil nil 0.001))
+(enwc-wicd-nw-prop-handler nil))
   (enwc-wicd-build-prop-list enwc-wicd-prop-values enwc-wicd-details-list))
 
 (defun enwc-wicd-get-encryption-type (id)



[elpa] master 89f9418 08/76: enwc.el (enwc-display-wireless-networks): Removed old comment.

2017-02-23 Thread Ian Dunn
branch: master
commit 89f9418a5641c5f96ddd8d516a6345cfe20c7ab1
Author: Ian D 
Commit: Ian D 

enwc.el (enwc-display-wireless-networks): Removed old comment.
---
 lisp/enwc.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index a11c307..2d6e455 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -634,7 +634,6 @@ NETWORKS must be in the format returned by
'("MODE" 15)
'("CHNL" 2
 
-;;TODO: Setup faces.
 (dolist (nw networks)
   (let ((id (cdr (assoc "id" nw)))
entry)



[elpa] master 245a82f 52/76: Moved Wicd and NetworkManager backends to new system.

2017-02-23 Thread Ian Dunn
branch: master
commit 245a82f5f875380f2c0f9a4255aaf2875fb0fa2c
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Moved Wicd and NetworkManager backends to new system.
---
 lisp/enwc-nm.el   | 108 +++-
 lisp/enwc-wicd.el | 133 --
 2 files changed, 146 insertions(+), 95 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index b6499ce..363cb3d 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -29,7 +29,9 @@
 ;;   This requires NetworkManager >= 0.9.6
 ;;
 
+(require 'enwc-backend)
 (require 'enwc)
+(require 'dbus)
 
 (defgroup enwc-nm nil
   "*NetworkManager variables for ENWC"
@@ -421,31 +423,31 @@ If STATE is 40, then NetworkManager is connecting to a 
new AP."
   (let* ((bytes (split-string addr "\\."))
  (byte-string (mapcar
(lambda (n) (lsh (string-to-number (nth n bytes))
-(* 8 n)))
+   (* 8 n)))
(number-sequence 0 3
 (apply 'logior byte-string)))
 
 ;; These next two come from libnm-util/nm-utils.c in NM's source.
 
-(defun enwc-nm-netmask-to-prefix (netmask)
-  "Convert a netmask to a CIDR prefix.
-NETMASK is an ip address in network byte order."
-  (if (and netmask (integerp netmask))
-  (progn
-(setq netmask (enwc--htonl netmask))
-(while (cl-evenp netmask)
-  (setq netmask (lsh netmask -1)))
-(floor (log (1+ netmask) 2)))
-0))
-
-(defun enwc-nm-prefix-to-netmask (prefix)
-  "Convert a CIDR prefix to a netmask.
-PREFIX is an integer <= 32."
-  (if (and prefix (integerp prefix))
-  (progn
-(setq prefix (min prefix 32))
-(enwc--htonl (lsh (1- (expt 2 prefix)) (- 32 prefix
-0))
+;; (defun enwc-nm-netmask-to-prefix (netmask)
+;;   "Convert a netmask to a CIDR prefix.
+;; NETMASK is an ip address in network byte order."
+;;   (if (and netmask (integerp netmask))
+;;   (progn
+;; (setq netmask (enwc--htonl netmask))
+;; (while (cl-evenp netmask)
+;;   (setq netmask (lsh netmask -1)))
+;; (floor (log (1+ netmask) 2)))
+;; 0))
+
+;; (defun enwc-nm-prefix-to-netmask (prefix)
+;;   "Convert a CIDR prefix to a netmask.
+;; PREFIX is an integer <= 32."
+;;   (if (and prefix (integerp prefix))
+;;   (progn
+;; (setq prefix (min prefix 32))
+;; (enwc--htonl (lsh (1- (expt 2 prefix)) (- 32 prefix
+;; 0))
 
 ;;
 ;; D-Bus Conversion ;;
@@ -537,27 +539,27 @@ representing another layer in the dictionary."
   (push `(:string (car ent) ,(enwc-nm-alist-to-dbus-dict (cadr ent))) ret)
   (push :dict-entry ret
 
-(defun enwc-nm-get-profile-info (ap  wired)
-  "Get the profile info for access point AP."
-  (let ((conn (enwc-nm--ap-to-conn ap))
-settings)
-(when conn
-  (setq settings (enwc-nm-get-settings conn)))
-(when settings
-  (let* ((adr-info (caar (enwc-nm-get-dbus-dict-entry "ipv4/addresses" 
settings)))
- (ip-addr (enwc-nm-convert-addr (nth 0 adr-info)))
- (netmask (enwc-nm-convert-addr (enwc-nm-prefix-to-netmask (nth 1 
adr-info
- (gateway (enwc-nm-convert-addr (nth 2 adr-info)))
- (dns-list (mapcar 'enwc-nm-convert-addr
-   (car (enwc-nm-get-dbus-dict-entry "ipv4/dns"
- settings
- (sec-info (enwc-nm-get-sec-info settings)))
-`((addr . ,ip-addr)
-  (netmask . ,netmask)
-  (gateway . ,gateway)
-  (dns1. ,(nth 0 dns-list))
-  (dns2. ,(nth 1 dns-list))
-  ,@sec-info)
+;; (defun enwc-nm-get-profile-info (ap  wired)
+;;   "Get the profile info for access point AP."
+;;   (let ((conn (enwc-nm--ap-to-conn ap))
+;; settings)
+;; (when conn
+;;   (setq settings (enwc-nm-get-settings conn)))
+;; (when settings
+;;   (let* ((adr-info (caar (enwc-nm-get-dbus-dict-entry "ipv4/addresses" 
settings)))
+;;  (ip-addr (enwc-nm-convert-addr (nth 0 adr-info)))
+;;  (netmask (enwc-nm-convert-addr (enwc-nm-prefix-to-netmask (nth 
1 adr-info
+;;  (gateway (enwc-nm-convert-addr (nth 2 adr-info)))
+;;  (dns-list (mapcar 'enwc-nm-convert-addr
+;;(car (enwc-nm-get-dbus-dict-entry "ipv4/dns"
+;;  
settings
+;;  (sec-info (enwc-nm-get-sec-info settings)))
+;; `((addr . ,ip-addr)
+;;   (netmask . ,netmask)
+;;   (gateway . ,gateway)
+;;   (dns1. ,(nth 0 dns-list))
+;;   (dns2. ,(nth 1 dns-list))
+;;   

[elpa] master 3b1bbc6 69/76: Fixed autoloads target in Makefile

2017-02-23 Thread Ian Dunn
branch: master
commit 3b1bbc692d968419539ac60bc4844ea11ce6ca17
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed autoloads target in Makefile

* Makefile: Set lisp files as dependency of enwc-autoloads.el.
---
 lisp/Makefile | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lisp/Makefile b/lisp/Makefile
index 618ae33..a51a016 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -1,6 +1,6 @@
 # This is part of ENWC
 #
-#  Copyright (C) 2012 Ian Dunn.
+#  Copyright (C) 2012-2017 Ian Dunn.
 #
 #  This program is free software: you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -15,12 +15,9 @@
 #  You should have received a copy of the GNU General Public License
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
-
 EMACS=emacs --batch
 ALLSRC= enwc-backend.el enwc.el enwc-wicd.el enwc-nm.el
 ALLELC=$(wildcard *.elc)
-EXPER=enwc-cm.el enwc-wpa.el enwc-edit.el
 SOURCE=$(ALLSRC)
 TARGET=$(patsubst %.el,%.elc,$(SOURCE))
 
@@ -31,7 +28,7 @@ all: $(TARGET)
-L "." \
-f batch-byte-compile $<
 
-enwc-autoloads.el:
+enwc-autoloads.el: $(SOURCE)
@$(EMACS) \
--eval "(require 'package)" \
--eval "(setq inhibit-message t)" \



[elpa] master 3491895 14/76: Cleaned up code and consolidated front-end functions.

2017-02-23 Thread Ian Dunn
branch: master
commit 3491895bb73e257d5a6c985fadcfd77e9128700b
Author: Ian D 
Commit: Ian D 

Cleaned up code and consolidated front-end functions.
---
 lisp/enwc-nm.el|  59 ---
 lisp/enwc-setup.el | 130 ---
 lisp/enwc-wicd.el  | 114 -
 lisp/enwc.el   | 295 +
 4 files changed, 355 insertions(+), 243 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 32a9245..15f93dd 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -238,7 +238,10 @@ ID is the identifier used by Network Manager."
   (let ((uuid (enwc-nm-get-uuid-by-id id)))
 (enwc-nm-get-conn-by-uuid uuid)))
 
-;; Wireless
+;
+;; Scan
+;
+
 (defun enwc-nm-scan ()
   "The NetworkManager scan function."
   (dbus-call-method :system
@@ -249,8 +252,16 @@ ID is the identifier used by Network Manager."
:timeout 25000
'(:array :signature "{sv}")))
 
-;; Wireless
-(defun enwc-nm-get-networks ()
+;
+;; Get networks
+;
+
+(defun enwc-nm-get-networks ( wired)
+  (if wired
+  (enwc-nm-get-wired-profiles)
+(enwc-nm-get-wireless-networks)))
+
+(defun enwc-nm-get-wireless-networks ()
   "The NetworkManager get networks function.
 This returns a list of D-Bus paths to the access points."
   (dbus-call-method :system
@@ -259,6 +270,18 @@ This returns a list of D-Bus paths to the access points."
enwc-nm-dbus-wireless-interface
"GetAccessPoints"))
 
+(defun enwc-nm-get-wired-profiles ()
+  (let ((profs-list (enwc-nm-list-connections)))
+(mapcar (lambda (x)
+ (let ((props (enwc-nm-get-settings x)))
+   (if (string= (caar props) "connection")
+   (car (cadr (car (cadr (car props
+   profs-list)))
+
+;;;
+;; Get network properties
+;;;
+
 ;; Accesspoint
 (defun enwc-nm-get-wireless-network-property (id prop)
   "The NetworkManager get wireless network property function.
@@ -361,9 +384,14 @@ If both are 0, then it returns WEP, otherwise WPA."
   "WPA")))
 
 ;; Default
-(defun enwc-nm-connect (id)
+(defun enwc-nm-connect (id  wired)
   "The NetworkManager connect function.
 This gets the connection path from ID, and connects to it."
+  (if wired
+  (enwc-nm-wired-connect id)
+(enwc-nm-wireless-connect id)))
+
+(defun enwc-nm-wireless-connect (id)
   (let ((ssid (enwc-nm-get-wireless-network-property id "Ssid")))
 (dbus-call-method :system
  enwc-nm-dbus-service
@@ -417,13 +445,7 @@ This simply checks for the active access point."
"Disconnect"))
 
 ;; Settings, Connections
-(defun enwc-nm-get-wired-profiles ()
-  (let ((profs-list (enwc-nm-list-connections)))
-(mapcar (lambda (x)
- (let ((props (enwc-nm-get-settings x)))
-   (if (string= (caar props) "connection")
-   (car (cadr (car (cadr (car props
-   profs-list)))
+
 
 (defun enwc-nm-wired-connect (id)
   (let ((nid (nth id enwc-access-points)))
@@ -552,7 +574,7 @@ PREFIX is an integer <= 32."
 (setq pf (1- pf)))
   netmask))
 
-(defun enwc-nm-get-nw-info (wired id)
+(defun enwc-nm-get-profile-info (id  wired)
   (let ((conn (enwc-nm-get-conn-by-nid id)))
 (if conn
(setq enwc-nm-edit-info
@@ -578,11 +600,14 @@ PREFIX is an integer <= 32."
dns-list (mapcar 'enwc-nm-convert-addr
 dns-list))
  (setq nw-info (list (cons (cons "addr"
- ip-addr) nil)
+ ip-addr)
+nil)
  (cons (cons "netmask"
- netmask) nil)
+ netmask)
+nil)
  (cons (cons "gateway"
- gateway) nil)
+ gateway)
+nil)
  (cons (cons "dns1"
  (nth 0
   dns-list))
@@ -592,8 +617,8 @@ PREFIX is an integer <= 32."
   dns-list))
nil)
  (cons (cons "enctype"
- "None") nil)
- )))
+ "None")
+nil
   nil)))
 
 (defun enwc-nm-get-ip-addr (wired id)
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 52f0a64..4e060ff 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -31,62 +31,68 @@
   "Sets up ENWC to use the correct 

[elpa] master 942d83d 15/76: enwc.el, enwc-setup.el: Consolidated and concretely defined front-end interface.

2017-02-23 Thread Ian Dunn
branch: master
commit 942d83dd249c992cc71e4d0493d6286b1d5561df
Author: Ian D 
Commit: Ian D 

enwc.el, enwc-setup.el: Consolidated and concretely defined front-end 
interface.
enwc-wicd.el, enwc-nm.el: Cleaned up code to fit front-end (excluding 
security)
enwc-cm.el: Added more to the back-end definition.
---
 doc/connman.txt|   29 +-
 lisp/enwc-cm.el|  350 ---
 lisp/enwc-nm.el| 1021 +---
 lisp/enwc-setup.el |  101 ++---
 lisp/enwc-wicd.el  |  299 ++---
 lisp/enwc.el   | 1205 +---
 6 files changed, 1556 insertions(+), 1449 deletions(-)

diff --git a/doc/connman.txt b/doc/connman.txt
index dafbe38..0084365 100644
--- a/doc/connman.txt
+++ b/doc/connman.txt
@@ -4,4 +4,31 @@ net.connman.Manager.GetTechnologies():
 
 net.connman.Manager.GetServices():
 
-(("/net/connman/service/wifi_0026b6e6518e_7270695f3830322e3178_managed_wep" 
(("Type" ("wifi")) ("Security" (("wep"))) ("State" ("idle")) ("Strength" (79)) 
("Favorite" (nil)) ("Immutable" (nil)) ("AutoConnect" (nil)) ("Name" 
("rpi_802.1x")) ("Ethernet" ((("Method" ("auto")) ("Interface" ("wlan0")) 
("Address" ("00:26:B6:E6:51:8E")) ("MTU" (1500) ("IPv4" (nil)) 
("IPv4.Configuration" ((("Method" ("dhcp") ("IPv6" (nil)) 
("IPv6.Configuration" ((("Method" ("auto")) ("Privacy" ("disabled [...]
+(("/net/connman/service/wifi_0026b6e6518e_7270695f3830322e3178_managed_wep"
+  (("Type" ("wifi"))
+   ("Security" (("wep")))
+   ("State" ("idle"))
+   ("Strength" (79))
+   ("Favorite" (nil))
+   ("Immutable" (nil))
+   ("AutoConnect" (nil))
+   ("Name" ("rpi_802.1x"))
+   ("Ethernet"
+ ((("Method" ("auto"))
+ ("Interface" ("wlan0"))
+ ("Address" ("00:26:B6:E6:51:8E"))
+ ("MTU" (1500)
+   ("IPv4" (nil))
+   ("IPv4.Configuration" ((("Method" ("dhcp")
+   ("IPv6" (nil))
+   ("IPv6.Configuration" ((("Method" ("auto")) ("Privacy" ("disabled")
+   ("Nameservers" (nil))
+   ("Nameservers.Configuration" (nil))
+   ("Timeservers" (nil))
+   ("Timeservers.Configuration" (nil))
+   ("Domains" (nil))
+   ("Domains.Configuration" (nil))
+   ("Proxy" (nil))
+   ("Proxy.Configuration" (nil))
+   ("Provider" (nil))
+   )) ("/net/connman/service/wifi_0026b6e6518e_hidden_managed_none" (("Type" 
("wifi")) ("Security" (("none"))) ("State" ("idle")) ("Strength" (79)) 
("Favorite" (nil)) ("Immutable" (nil)) ("AutoConnect" (nil)) ("Ethernet" 
((("Method" ("auto")) ("Interface" ("wlan0")) ("Address" ("00:26:B6:E6:51:8E")) 
("MTU" (1500) ("IPv4" (nil)) ("IPv4.Configuration" ((("Method" ("dhcp") 
("IPv6" (nil)) ("IPv6.Configuration" ((("Method" ("auto")) ("Privacy" 
("disabled") ("Nameservers" (nil)) (" [...]
diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
index 21faba6..5ff6eef 100644
--- a/lisp/enwc-cm.el
+++ b/lisp/enwc-cm.el
@@ -55,97 +55,313 @@
   :group 'enwc-cm
   :type 'string)
 
+(defcustom enwc-cm-dbus-technology-interface "net.connman.Technology"
+  "ConnMan D-Bus Technology Interface"
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-technology-path "/net/connman/technology/"
+  "ConnMan D-Bus Technology Path"
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-service-path "/net/connman/service"
+  "ConnMan D-Bus Service Path"
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-agent-service "org.gnu.enwc.agent"
+  "The service for the ConnMan Agent for ENWC to use."
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-agent-path "/org/gnu/enwc/agent"
+  "The path to the Agent for ENWC to use for ConnMan security."
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-agent-interface "org.gnu.enwc.agent"
+  "The interface for the ConnMan Agent for ENWC to use."
+  :group 'enwc-cm
+  :type 'string)
+
 (defvar enwc-cm-details-list
-  '("Name" "bssid" "Strength" "Security" "mode" "channel"))
+  '("Name" "Ethernet/Address" "Strength" "Security" "mode" "channel"))
 
-(defun enwc-cm-get-services ()
-  (dbus-call-method :system
-   enwc-cm-dbus-service
-   "/"
-   enwc-cm-dbus-manager-interface
-   "GetServices"))
+(defun enwc-cm-get-wifi-tech-path ()
+  "Return the ConnMan Wifi Technology path."
+  (concat enwc-cm-dbus-technology-path "wifi"))
 
-(defun enwc-cm-get-networks ()
-  (let ((services (enwc-cm-get-services)))
-(mapcar 'car services)))
+(defun enwc-cm-get-wired-tech-path ()
+  "Return the ConnMan Ethernet Technology path."
+  (concat enwc-cm-dbus-technology-path "ethernet"))
 
 (defun enwc-cm-get-network (id)
   (nth id (enwc-cm-get-services)))
 
-;; scan
-(defun enwc-cm-scan (wired)
-  (dbus-call-method :system
-   enwc-cm-dbus-service
-   "/net/connman/technology/(ethernet|wifi)"
-   "net.connman.Technology"
-   "Scan"))
-
 ;; connect
 (defun enwc-cm-connect (wired id)
-  

[elpa] master 33515f8 66/76: Silenced byte-compiler.

2017-02-23 Thread Ian Dunn
branch: master
commit 33515f878626f258025dcdfa42efb6b884ce868c
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Silenced byte-compiler.

enwc-nm.el: Require subr-x.el.
---
 lisp/enwc-nm.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index df42d1e..2b68400 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -32,6 +32,7 @@
 (require 'enwc-backend)
 (require 'enwc)
 (require 'dbus)
+(require 'subr-x)
 
 (defgroup enwc-nm nil
   "*NetworkManager variables for ENWC"



[elpa] master 742b67a 19/76: Removed several network manager functions.

2017-02-23 Thread Ian Dunn
branch: master
commit 742b67a7fd3ee89079f222706328935cdfbefd1e
Author: Ian D 
Commit: Ian D 

Removed several network manager functions.
---
 lisp/enwc-nm.el | 59 -
 1 file changed, 59 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index fd882d3..8124a27 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -198,60 +198,6 @@ CONN is an object path to the connection."
 (defun enwc-nm-get-device-by-name (name)
   (enwc-nm-dbus-default-call-method "GetDeviceByIpIface" :string name))
 
-;; Settings, Connections
-(defun enwc-nm-get-uuid-by-ssid (ssid)
-  "Gets the uuid of the network with ssid SSID."
-  (let ((conns (enwc-nm-list-connections))
-cur-conn cur-ssid uuid)
-(while (and conns (not uuid))
-  (setq cur-conn (pop conns))
-  (let ((settings (enwc-nm-get-settings cur-conn)))
-(when (assoc "802-11-wireless" settings)
-  (setq cur-ssid
-(dbus-byte-array-to-string (car (cadr (assoc "ssid"
- (cadr (assoc 
"802-11-wireless"
-  
settings)))
-  (when (string= cur-ssid ssid)
-(setq uuid
-  (car (cadr (assoc "uuid"
-(cadr (assoc "connection"
- settings))
-uuid))
-
-(defun enwc-nm-get-uuid-by-id (id)
-  "Gets a network connection's uuid by the network's id.
-ID is a string that NetworkManager uses to identify this network."
-  (let ((conns (enwc-nm-list-connections))
-cur-conn cur-id uuid)
-(while (and conns (not uuid))
-  (setq cur-conn (pop conns))
-  (let ((settings (enwc-nm-get-settings cur-conn))
-conn-set)
-(when (assoc "connection" settings)
-  (setq conn-set (assoc "connection" settings))
-  (setq cur-id (car (cadr (assoc "id" (cadr conn-set)
-  (when (string= cur-id id)
-(setq uuid (car (cadr (assoc "uuid" (cadr conn-set)))
-
-(defun enwc-nm-get-conn-by-uuid (uuid)
-  (enwc-nm-dbus-settings-call-method "GetConnectionByUuid"
- uuid))
-
-;; Settings
-;; Not used.
-(defun enwc-nm-get-conn-by-ssid (ssid)
-  "Gets the connection path for the access point with ssid SSID."
-  (let ((uuid (enwc-nm-get-uuid-by-ssid ssid)))
-(when uuid
-  (enwc-nm-get-conn-by-uuid uuid
-
-;; Not used.
-(defun enwc-nm-get-conn-by-id (id)
-  "Gets a connection object with the id ID.
-ID is the identifier used by Network Manager."
-  (let ((uuid (enwc-nm-get-uuid-by-id id)))
-(enwc-nm-get-conn-by-uuid uuid)))
-
 ;
 ;; Get networks
 ;
@@ -436,11 +382,6 @@ STATE is the new state."
 (defun enwc-nm-is-wired ()
   enwc-nm-wired-p)
 
-(defun enwc-nm-get-sec-types ( wired)
-  "Get security types."
-  (unless wired
-enwc-nm-sec-types))
-
 (defun enwc-nm-gen-uuid ()
   (random t)
   (let ((hex-nums



[elpa] master bcb33e6 30/76: (enwc-get-networks): Improved docstring.

2017-02-23 Thread Ian Dunn
branch: master
commit bcb33e6d1fca1ad85a44360f8da40defda94c2a8
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

(enwc-get-networks): Improved docstring.
Passes `enwc-using-wired' to back-end.
(enwc-do-scan): Renamed to `enwc-request-scan'.
(enwc-scan): Improved docstring and fixed up code.
(enwc-scan-internal-wireless): Improved docstring.
(enwc-display-wired-networks): Uses tabulated list functions.
(enwc-scan-internal-wired): Implemented `enwc-display-wired-networks'.
(*-func): Changed to *-function.
(enwc-connect-network): When using wired, return the network id.
(enwc-connect-to-network, enwc-connect-to-network-essid, 
enwc-connect-to-network-at-point, enwc-disconnect-network): Fixed docstring.
(enwc-connect-to-network): Fixed use of `message'.
(enwc-scan-done): Removed.
(enwc-refresh-widths): New function to refresh column widths.
(enwc-display-wireless-networks): Moved width updating here.
(enwc-process-scan): Does not update column widths.
---
 lisp/enwc.el | 153 ---
 1 file changed, 72 insertions(+), 81 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 669360c..78a835f 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -1,44 +1,43 @@
 ;;; enwc.el --- The Emacs Network Client
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
 
-;; Author: Ian Dunn
-;; Keywords: enwc, network, wicd, manager, nm
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
 
-;; This file is part of ENWC
+;; This file is part of GNU Emacs.
 
-;; ENWC is free software; you can redistribute it and/or modify it
+;; GNU Emacs is free software; you can redistribute it and/or modify it
 ;; under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
-;; ENWC is distributed in the hope that it will be useful, but WITHOUT
+;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 ;; License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with ENWC; see the file COPYING.  If not, write to the Free
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 ;; 02110-1301, USA.
 
-;; connect
-;; disconnect
-;; scan
-;; get-network-prop
-;; get-profile-prop
-;; save-profile
-;; get-networks
-;; check-connecting
-;; get-current-nw-id
-
 ;;; Commentary:
-;; In order to use this, add
+;;
+;; ENWC is the Emacs Network Client.  It is designed to provide a front-end to
+;; various network managers, such as NetworkManager and Wicd.
+;;
+;; Currently, only NetworkManager and Wicd are supported, although experimental
+;; support exists for Connman.
+;;
+;; In order to use this package, add
 ;;
 ;; (require 'enwc-setup)
 ;; (enwc-setup)
 ;;
-;; to your .emacs file.
+;; to your .emacs file (or other init file).
 
 (require 'dbus)
 (require 'wid-edit)
@@ -112,41 +111,41 @@ connection.
 
 ;;; The function variables for the abstract layer.
 
-(defvar enwc-scan-func nil
+(defvar enwc-scan-function nil
   "The function variable for the scan function.
 This variable is set during setup.")
 
-(defvar enwc-get-networks-func nil
+(defvar enwc-get-networks-function nil
   "A function variable to be used in `enwc-get-networks'.
 This is redefined during setup to be the function to get the network
  list.")
 
-(defvar enwc-get-wireless-nw-props-func nil)
+(defvar enwc-get-wireless-nw-props-function nil)
 
-(defvar enwc-connect-func nil
+(defvar enwc-connect-function nil
   "The function variable for the connect function.")
 
-(defvar enwc-disconnect-func nil
+(defvar enwc-disconnect-function nil
   "The function variable for the disconnect function.")
 
-(defvar enwc-get-current-nw-id-func nil
+(defvar enwc-get-current-nw-id-function nil
   "The function variable to be used in `enwc-get-current-nw-id'.
 This is redefined during setup to be the function to get
 the current network id.")
 
-(defvar enwc-check-connecting-func nil
+(defvar enwc-check-connecting-function nil
   "The function variable to be used in `enwc-check-connecting'.
 This is redefined during setup to be the function to
 check whether or not ENWC is connecting.")
 
-(defvar enwc-is-wired-func nil
+(defvar enwc-is-wired-function nil
   "The function variable to be used in `enwc-is-wired'.
 This is redefined during setup to be the function to
 check whether or not a wired connection is active.")
 
-(defvar enwc-get-pro

[elpa] master a46fe3c 64/76: Don't switch to the ENWC buffer when processing a scan.

2017-02-23 Thread Ian Dunn
branch: master
commit a46fe3c0a97eac045c4cc59579cee76fb9308777
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Don't switch to the ENWC buffer when processing a scan.

* enwc.el (enwc-process-scan): Don't switch to the ENWC buffer when 
finished.
---
 lisp/enwc.el | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 4bc9539..215381a 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -460,8 +460,6 @@ ARGS is only for compatibility with the calling function."
   (message "Scanning... Done"))
 (enwc--update-scan-results)
 (enwc-display-wireless-networks enwc-last-scan)
-(when enwc-scan-interactive
-  (pop-to-buffer "*ENWC*"))
 (setq enwc-scan-interactive nil)))
 
 ;;



[elpa] master 6ed7137 43/76: Fix adding to global-mode-string.

2017-02-23 Thread Ian Dunn
branch: master
commit 6ed7137fea03e30ba3301d44804d876c2ed4a622
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fix adding to global-mode-string.

* enwc-setup.el (enwc-setup): Use 'add-to-list' instead of 'cl-pushnew'.
---
 lisp/enwc-setup.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 014cb74..a3d0984 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -97,7 +97,7 @@
   "Sets up ENWC.
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
-  (cl-pushnew 'enwc-display-string global-mode-string :test #'equal)
+  (add-to-list 'global-mode-string 'enwc-display-string t #'equal)
   (unless enwc-mode-line-timer
 (setq enwc-mode-line-timer (run-at-time t 1 'enwc-update-mode-line)))
   (let ((cur-back nil)



[elpa] master 2e271c6 72/76: Moved lisp files into top-level directory.

2017-02-23 Thread Ian Dunn
branch: master
commit 2e271c69bb277dcf6193517a78b658ad7b4c1e3a
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Moved lisp files into top-level directory.
---
 Makefile| 36 ---
 lisp/enwc-backend.el => enwc-backend.el |  0
 lisp/enwc-cm.el => enwc-cm.el   |  0
 lisp/enwc-edit.el => enwc-edit.el   |  0
 lisp/enwc-nm.el => enwc-nm.el   |  0
 lisp/enwc-wicd.el => enwc-wicd.el   |  0
 lisp/enwc.el => enwc.el |  0
 lisp/Makefile   | 38 -
 8 files changed, 24 insertions(+), 50 deletions(-)

diff --git a/Makefile b/Makefile
index a99c195..eba3a7d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 # This is part of ENWC
 #
-#  Copyright (C) 2012-2016 Ian Dunn.
+#  Copyright (C) 2012-2017 Ian Dunn.
 #
 #  This program is free software: you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -15,25 +15,40 @@
 #  You should have received a copy of the GNU General Public License
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-LISPDIR=lisp
 DOCDIR=doc/
 
-ALLSRC=$(wildcard $(LISPDIR)/*.el)
-ALLELC=$(wildcard $(LISPDIR)/*.elc)
-
 PREFIX=/usr/local
 INFODIR=$(PREFIX)/info
 SITELISP=$(PREFIX)/share/emacs/site-lisp/enwc
 
+EMACS=emacs --batch
+ALLSRC= enwc-backend.el enwc.el enwc-wicd.el enwc-nm.el
+ALLELC=$(wildcard *.elc)
+
+SOURCE=$(ALLSRC)
+TARGET=$(patsubst %.el,%.elc,$(SOURCE))
+
 .PHONY: all install lisp clean
 .PRECIOUS: %.elc
 all: lisp
 
-lisp:
-   $(MAKE) -C $(LISPDIR)
+lisp: $(ALLELC)
+
+%.elc: %.el
+   @$(EMACS) \
+   -L "." \
+   -f batch-byte-compile $<
+
+autoloads: enwc-autoloads.el
 
-autoloads:
-   $(MAKE) -C $(LISPDIR) enwc-autoloads.el
+enwc-autoloads.el: $(SOURCE)
+   @$(EMACS) \
+   --eval "(require 'package)" \
+   --eval "(setq inhibit-message t)" \
+   --eval "(package-generate-autoloads \"enwc\" \"$$(pwd)\")"
+
+clean:
+   -rm -f *.elc
 
 install:
install -m 644 $(ALLELC) $(SITELISP)
@@ -42,6 +57,3 @@ install:
 uninstall:
-rm -f $(SITELISP)/*.elc
-rm -f $(SITELISP)/*.el
-
-clean:
-   $(MAKE) -C $(LISPDIR) clean
diff --git a/lisp/enwc-backend.el b/enwc-backend.el
similarity index 100%
rename from lisp/enwc-backend.el
rename to enwc-backend.el
diff --git a/lisp/enwc-cm.el b/enwc-cm.el
similarity index 100%
rename from lisp/enwc-cm.el
rename to enwc-cm.el
diff --git a/lisp/enwc-edit.el b/enwc-edit.el
similarity index 100%
rename from lisp/enwc-edit.el
rename to enwc-edit.el
diff --git a/lisp/enwc-nm.el b/enwc-nm.el
similarity index 100%
rename from lisp/enwc-nm.el
rename to enwc-nm.el
diff --git a/lisp/enwc-wicd.el b/enwc-wicd.el
similarity index 100%
rename from lisp/enwc-wicd.el
rename to enwc-wicd.el
diff --git a/lisp/enwc.el b/enwc.el
similarity index 100%
rename from lisp/enwc.el
rename to enwc.el
diff --git a/lisp/Makefile b/lisp/Makefile
deleted file mode 100644
index a51a016..000
--- a/lisp/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# This is part of ENWC
-#
-#  Copyright (C) 2012-2017 Ian Dunn.
-#
-#  This program is free software: you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation, either version 3 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-EMACS=emacs --batch
-ALLSRC= enwc-backend.el enwc.el enwc-wicd.el enwc-nm.el
-ALLELC=$(wildcard *.elc)
-SOURCE=$(ALLSRC)
-TARGET=$(patsubst %.el,%.elc,$(SOURCE))
-
-all: $(TARGET)
-
-%.elc: %.el
-   @$(EMACS) \
-   -L "." \
-   -f batch-byte-compile $<
-
-enwc-autoloads.el: $(SOURCE)
-   @$(EMACS) \
-   --eval "(require 'package)" \
-   --eval "(setq inhibit-message t)" \
-   --eval "(package-generate-autoloads \"enwc\" \"$$(pwd)\")"
-
-clean:
-   -rm -f *.elc



[elpa] master 8e44368 68/76: Moved enwc-setup to enwc.el, and added it to enwc.

2017-02-23 Thread Ian Dunn
branch: master
commit 8e44368d4e404f2b4a1e80cd4a8995f986c58027
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Moved enwc-setup to enwc.el, and added it to enwc.

* enwc-backend.el (enwc-force-backend-loading): New defcustom to force 
loading
  of default backend in enwc-setup.
  (enwc-load-backend): Load the file that contains the backend.

* enwc.el (enwc-display-mode-line): Fixed default.
  (enwc-auto-scan): Changed default to nil.
  (enwc--setup-done): New defvar to determine if setup has been run.
  (enwc-setup): Added.
  (enwc): Call enwc-setup.
---
 lisp/enwc-backend.el |  9 
 lisp/enwc-setup.el   | 59 
 lisp/enwc.el | 37 ++--
 3 files changed, 40 insertions(+), 65 deletions(-)

diff --git a/lisp/enwc-backend.el b/lisp/enwc-backend.el
index fa4083f..a296477 100644
--- a/lisp/enwc-backend.el
+++ b/lisp/enwc-backend.el
@@ -66,8 +66,14 @@ an enwc-backend struct.")
   :type 'symbol
   :group 'enwc)
 
+(defcustom enwc-force-backend-loading nil
+  "Non-nil if backends should be loaded even if they claim they cannot."
+  :type 'boolean
+  :group 'enwc)
+
 (defvar enwc--current-backend nil)
 
+;;;###autoload
 (defun enwc-register-backend (definition  forcep)
   "Register the backend KEY with DEFINITION.
 
@@ -125,6 +131,9 @@ Signals an error if a backend with KEY already exists and 
FORCEP is nil."
  (not (eq (enwc-backend-key enwc--current-backend) backend)))
 (enwc-unload-current-backend))
 
+  (unless (require (intern (format "enwc-%s" backend)) nil t)
+(error "Cannot find enwc feature for backend %s" backend))
+
   (let ((new-backend (map-elt enwc-registered-backend-alist backend)))
 (unless new-backend
   (error "No registered backend %s" backend))
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
deleted file mode 100644
index 5c463c7..000
--- a/lisp/enwc-setup.el
+++ /dev/null
@@ -1,59 +0,0 @@
-;; enwc-setup.el - Setup routines for ENWC
-
-;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
-
-;; Author: Ian Dunn <du...@gnu.org>
-;; Keywords: network, wicd, manager, nm
-;; Version: 2.0
-;; Homepage: https://savannah.nongnu.org/p/enwc
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software; you can redistribute it and/or modify it
-;; under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
-;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-;; License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
-;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-;; 02110-1301, USA.
-
-;;; Commentary:
-
-;;; Code:
-
-(require 'enwc)
-(require 'enwc-backend)
-(require 'enwc-wicd)
-(require 'enwc-nm)
-
-;;;###autoload
-(defun enwc-setup ()
-  "Set up ENWC.
-This sets up ENWC and confirms that one of the backends can be found on D-Bus."
-  (when enwc-display-mode-line
-(enwc-enable-display-mode-line))
-
-  (when (and enwc-auto-scan
- (> enwc-auto-scan-interval 0)
- (not enwc-scan-timer))
-(setq enwc-scan-timer
-  (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
-
-  (let ((back-list enwc-backends)
-cur-back pass)
-(while (and back-list (not pass))
-  (setq cur-back (pop back-list))
-  (setq pass (ignore-errors (enwc-load-backend cur-back
-(unless pass
-  (error "No usable backend was found."
-
-(provide 'enwc-setup)
-
-;;; enwc-setup.el ends here
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 215381a..dfd2511 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -35,12 +35,11 @@
 ;;
 ;; In order to use this package, add
 ;;
-;; (require 'enwc)
-;; (enwc-load-default-backend)
-;; (enwc-enable-auto-scan)
-;; (enwc-enable-display-mode-line)
+;; (setq enwc-default-backend 'backend-symbol)
 ;;
 ;; to your .emacs file (or other init file).
+;;
+;; Then you can just run `enwc' to start everything.
 
 ;;; TODO:
 ;;
@@ -76,13 +75,13 @@
   :group 'enwc
   :type 'string)
 
-(defcustom enwc-display-mode-line 't
+(defcustom enwc-display-mode-line t
   "Non-nil means display network information in the mode line.
 The specific information can be set using `enwc-mode-line-format'."
   :group 'enwc
   :type 'boolean)
 
-(defcustom enwc-auto-scan 't
+(defcustom enwc-auto-scan nil
   "Whether or not to have ENWC automatically scan.
 If non-nil, then ENWC will automatically scan for
 networks every `enwc-auto-scan-interval' seconds."

[elpa] master 14bcaf4 67/76: Fixed bug with NetworkManager loading

2017-02-23 Thread Ian Dunn
branch: master
commit 14bcaf41f49db9612098c59d681e06cd0ec571e1
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed bug with NetworkManager loading

* enwc-nm.el (enwc-nm-can-load-p): Check introspection to see if 
NetworkManager
  D-Bus service has started.
---
 lisp/enwc-nm.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 2b68400..04e1813 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -714,7 +714,9 @@ Unregister all of the D-Bus signals set up during load."
   (dbus-unregister-object enwc-nm-state-changed-signal))
 
 (defun enwc-nm-can-load-p ()
-  (dbus-ping :system enwc-nm-dbus-service))
+  ;; (dbus-ping :system enwc-nm-dbus-service)
+  ;; NetworkManager doesn't allow Ping, so we have to use an alternative.
+  (dbus-introspect :system enwc-nm-dbus-service enwc-nm-dbus-path))
 
 (enwc-register-backend
  (make-enwc-backend



[elpa] master 2d5def6 36/76: (*-function): Removed.

2017-02-23 Thread Ian Dunn
branch: master
commit 2d5def6fd8fd8b3e8b336ac4b850abb6d9242738
Author: Ian D 
Commit: Ian D 

(*-function): Removed.
(enwc-current-backend): New variable.
(enwc-call-backend-function): New function to replace backend variables.
(enwc-get-networks, enwc-request-scan, enwc-connect, enwc-disconnect, 
enwc-get-current-nw-id, enwc-check-connecting-p, enwc-get-wireless-nw-props, 
enwc-is-wired-p, enwc-get-profile-info, enwc-save-nw-settings): Implemented 
`enwc-call-backend-function'.
(enwc-load-backend): New function to load backend.
(enwc-unload-backend): New function to unload backend.
(enwc-setup): Implemented `enwc-load-backend'.
---
 lisp/enwc-setup.el |  71 ++---
 lisp/enwc.el   | 178 +++--
 2 files changed, 109 insertions(+), 140 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 746d297..0a4d69a 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -32,56 +32,49 @@
 (require 'enwc-wicd)
 (require 'enwc-nm)
 
-(defvar enwc-backend-symbol-list
-  '("scan"
-"get-networks"
-"get-wireless-nw-props"
-"connect"
-"disconnect"
-"get-current-nw-id"
-"check-connecting"
-"is-wired"
-"get-profile-info"
-"save-nw-settings"))
-
-(defun enwc--intern-sym (sym-name suffix)
-  (intern (concat "enwc-" sym-name suffix)))
-
-(defun enwc--setq-backend (backend func)
-  "Set a backend function."
-  (set (intern (concat "enwc-" func "-func"))
-   (intern (concat "enwc-" backend "-" func
-
-(defun enwc-setup-backend (cur-back)
-  "Set up ENWC to use the correct function for the backend CUR-BACK."
-  (let* ((sym-name (symbol-name cur-back))
- (esb (apply-partially 'enwc--setq-backend sym-name)))
-(cl-mapc esb enwc-backend-symbol-list)
-(funcall (enwc--intern-sym sym-name "-setup"
+(defun enwc-load-backend ( backend)
+  "Load the backend BACKEND."
+  (interactive)
+  (unless backend
+(setq backend
+  (completing-read "Backend: " enwc-backends nil t)))
+  (when (and enwc-current-backend
+ (not (eq enwc-current-backend backend)))
+(enwc-unload-backend))
+  (let ((service (symbol-value (intern (concat "enwc-"
+   (symbol-name backend)
+   "-dbus-service")
+(unless (dbus-ping :system service)
+  (error "Backend %s is not usable." backend))
+
+(enwc-call-backend-function "load" backend)
+(setq enwc-current-backend backend)))
+
+(defun enwc-unload-backend ()
+  "Unload the current backend."
+  (when enwc-current-backend
+(enwc-call-backend-function "unload")
+(setq enwc-current-backend nil)))
 
 (defun enwc-setup ()
   "Set up ENWC.
-This setups ENWC and confirms that one of the backends can be found
-on D-Bus."
+This sets up ENWC and confirms that one of the backends can be found on D-Bus."
   (when enwc-display-mode-line
 (enwc-enable-display-mode-line))
 
-  (when (and enwc-auto-scan (> enwc-auto-scan-interval 0))
+  (when (and enwc-auto-scan
+ (> enwc-auto-scan-interval 0)
+ (not enwc-scan-timer))
 (setq enwc-scan-timer
   (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
 
   (let ((back-list enwc-backends)
-cur-back)
-(while (and back-list (not cur-back))
+cur-back pass)
+(while (and back-list (not pass))
   (setq cur-back (pop back-list))
-  (unless (dbus-ping :system
- (symbol-value (intern (concat "enwc-"
-   (symbol-name cur-back)
-   "-dbus-service"
-(setq cur-back nil)))
-(if cur-back
-(enwc-setup-backend cur-back)
-  (error "No usable backend found."
+  (setq pass (ignore-errors (enwc-load-backend cur-back
+(unless pass
+  (error "No usable backend was found."
 
 (provide 'enwc-setup)
 
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 78a835f..6c10d34 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -111,44 +111,10 @@ connection.
 
 ;;; The function variables for the abstract layer.
 
-(defvar enwc-scan-function nil
-  "The function variable for the scan function.
-This variable is set during setup.")
+(defvar enwc-current-backend nil
+  "The backend that ENWC is currently using.
 
-(defvar enwc-get-networks-function nil
-  "A function variable to be used in `enwc-get-networks'.
-This is redefined during setup to be the function to get the network
- list.")
-
-(defvar enwc-get-wireless-nw-props-function nil)
-
-(defvar enwc-connect-function nil
-  "The function variable for the connect function.")
-
-(defvar enwc-disconnect-function nil
-  "The function variable for the disconnect function.")
-
-(defvar enwc-get-current-nw-id-function nil
-  "The function variable to be used in `enwc-get-current-nw-id'.
-This is 

[elpa] master d6bee52 32/76: (enwc-wicd.el): Fixed opening header.

2017-02-23 Thread Ian Dunn
branch: master
commit d6bee529de4c8b2149ae06191762172e22768d96
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

(enwc-wicd.el): Fixed opening header.
(enwc-wicd-end-scan-signal, enwc-wicd-status-changed-signal): New variables.
(enwc-wicd-setup): Store registered signals.
(enwc-wicd-unload): New function to unregister signals.
---
 lisp/enwc-wicd.el | 71 ---
 1 file changed, 47 insertions(+), 24 deletions(-)

diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index a637696..27a202e 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -1,30 +1,34 @@
 ;;; enwc-wicd.el --- The Wicd backend to ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
 
-;; Author: Ian Dunn
-;; Keywords: enwc, network, wicd, manager, nm
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
 
-;; This file is part of ENWC
+;; This file is part of GNU Emacs
 
-;; ENWC is free software; you can redistribute it and/or modify it
+;; GNU Emacs is free software; you can redistribute it and/or modify it
 ;; under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
-;; ENWC is distributed in the hope that it will be useful, but WITHOUT
+;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 ;; License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with ENWC; see the file COPYING.  If not, write to the Free
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 ;; 02110-1301, USA.
 
-
 ;;; Commentary:
-;; TODO
+
+;; Wicd is one of the default supported back-ends for ENWC.
+
+;;; Code:
 
 (require 'enwc)
 
@@ -62,9 +66,19 @@
   '("essid" "bssid" "quality" "encryption" "channel")
   "The list of the desired details to be obtained from each network.")
 
-(defvar enwc-wicd-current-ap "")
+(defvar enwc-wicd-current-ap ""
+  "Current access point.
+UNUSED")
+
+(defvar enwc-wicd-current-nw-id -1
+  "Id of the current network.
+UNUSED")
+
+(defvar enwc-wicd-end-scan-signal nil
+  "D-Bus signal object for the \"SendEndScanSignal\" signal.")
 
-(defvar enwc-wicd-current-nw-id -1)
+(defvar enwc-wicd-status-changed-signal nil
+  "D-Bus signal objects for the \"StatusChanged\" signal.")
 
 (defun enwc-wicd-dbus-wireless-call-method (method  args)
   "Calls D-Bus method METHOD with arguments ARGS within
@@ -399,19 +413,28 @@ WIRED indicates whether or not ID is a wired connection."
 (defun enwc-wicd-setup ()
   "Setup the Wicd backend."
   ;; Thanks to Michael Albinus for pointing out this signal.
-  (dbus-register-signal :system
-enwc-wicd-dbus-service
-enwc-wicd-dbus-wireless-path
-enwc-wicd-dbus-wireless-interface
-"SendEndScanSignal"
-'enwc-process-scan)
-
-  (dbus-register-signal :system
-enwc-wicd-dbus-service
-"/org/wicd/daemon"
-enwc-wicd-dbus-service
-"StatusChanged"
-'enwc-wicd-wireless-prop-changed))
+  (setq enwc-wicd-end-scan-signal
+(dbus-register-signal :system
+  enwc-wicd-dbus-service
+  enwc-wicd-dbus-wireless-path
+  enwc-wicd-dbus-wireless-interface
+  "SendEndScanSignal"
+  'enwc-process-scan))
+
+  (setq enwc-wicd-status-changed-signal
+(dbus-register-signal :system
+  enwc-wicd-dbus-service
+  "/org/wicd/daemon"
+  enwc-wicd-dbus-service
+  "StatusChanged"
+  'enwc-wicd-wireless-prop-changed)))
+
+(defun enwc-wicd-unload ()
+  "Unload the Wicd back-end.
+
+Unregister all of the D-Bus signals set up during load."
+  (dbus-unregister-object enwc-wicd-end-scan-signal)
+  (dbus-unregister-object enwc-wicd-status-changed-signal))
 
 (provide 'enwc-wicd)
 



[elpa] master 968e6f0 46/76: Added tag 2.0 for changeset cc2f7aa4ed36

2017-02-23 Thread Ian Dunn
branch: master
commit 968e6f09a94960aec896d69e4ef65579460b5939
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Added tag 2.0 for changeset cc2f7aa4ed36
---
 .hgtags | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.hgtags b/.hgtags
index 820ec4a..d28cc38 100644
--- a/.hgtags
+++ b/.hgtags
@@ -1,3 +1,5 @@
 3e2cab525cbc1c8664207fe9c01978335911b0a3 2.0
 3e2cab525cbc1c8664207fe9c01978335911b0a3 2.0
  2.0
+ 2.0
+cc2f7aa4ed369769e4aec5cdc4a6b1a2d28375b3 2.0



[elpa] master 03a5464 57/76: Changed channel to an integer.

2017-02-23 Thread Ian Dunn
branch: master
commit 03a546421e6525ac853bdeb3f3188f7893d0bc68
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Changed channel to an integer.

* enwc-nm.el (enwc-nm-get-wireless-nw-props): Changed channel to an integer.

* enwc-wicd.el (enwc-wicd-build-prop-list): Changed channel to an integer.
---
 lisp/enwc-nm.el   | 4 ++--
 lisp/enwc-wicd.el | 7 +--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 363cb3d..b0b51f8 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -336,8 +336,8 @@ PROP from that access point.  It also sets the channel from 
the
   (bssid. ,(cdr (assoc "HwAddress" props)))
   (strength . ,(cdr (assoc "Strength" props)))
   (encrypt  . ,(or (enwc-nm-get-encryption-type nw) "Unsecured"))
-  (channel  . ,(number-to-string (enwc-nm--freq-to-channel
-  (cdr (assoc "Frequency" props
+  (channel  . ,(enwc-nm--freq-to-channel
+(cdr (assoc "Frequency" props)))
 
 (defun enwc-nm-get-encryption-type (nw)
   "The NetworkManager get encryption type function.
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index cb64fa8..b321c00 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -142,7 +142,7 @@ Just returns a number sequence."
   "The handler for `enwc-wicd-get-wireless-network-property'.
 This receives the value of network property PROP,
 and appends the value to `enwc-wicd-prop-values'."
-  (push `(,prop . ,(car args)) enwc-wicd-prop-values)
+  (push (cons prop (car args)) enwc-wicd-prop-values)
   (setq enwc-wicd-prop-num (1+ enwc-wicd-prop-num)))
 
 (defun enwc-wicd-prop-to-prop (prop)
@@ -175,7 +175,10 @@ from wireless network with id ID."
  (let* ((cur-prop (assoc det prop-list))
 (act-det (enwc-wicd-prop-to-prop det))
 (act-prop (when cur-prop (cdr cur-prop
-   `(,act-det . ,act-prop)))
+   (when (or (string-equal det "essid")
+ (string-equal det "channel"))
+ (setq act-prop (string-to-number cur-prop)))
+   (cons act-det act-prop)))
det-list))
 
 (defun enwc-wicd-get-wireless-nw-props (id)



[elpa] master c9a94c8 44/76: Added tag 2.0 for changeset 3e2cab525cbc

2017-02-23 Thread Ian Dunn
branch: master
commit c9a94c8308784c53f7a67d298b53ec83feffc566
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Added tag 2.0 for changeset 3e2cab525cbc
---
 .hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.hgtags b/.hgtags
new file mode 100644
index 000..25999b2
--- /dev/null
+++ b/.hgtags
@@ -0,0 +1 @@
+3e2cab525cbc1c8664207fe9c01978335911b0a3 2.0



[elpa] master 62fe017 71/76: Removed some files from docs.

2017-02-23 Thread Ian Dunn
branch: master
commit 62fe017b21bd5727e4058322c3fd32dbe794e687
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Removed some files from docs.
---
 doc/connman.txt  |  34 -
 doc/nm-dbus.txt  | 390 ---
 doc/settings.txt |  11 --
 3 files changed, 435 deletions(-)

diff --git a/doc/connman.txt b/doc/connman.txt
deleted file mode 100644
index 0084365..000
--- a/doc/connman.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-net.connman.Manager.GetTechnologies():
-
-(("/net/connman/technology/ethernet" (("Name" ("Wired")) ("Type" ("ethernet")) 
("Powered" (t)) ("Connected" (nil)) ("Tethering" (nil 
("/net/connman/technology/wifi" (("Name" ("WiFi")) ("Type" ("wifi")) ("Powered" 
(t)) ("Connected" (nil)) ("Tethering" (nil)
-
-net.connman.Manager.GetServices():
-
-(("/net/connman/service/wifi_0026b6e6518e_7270695f3830322e3178_managed_wep"
-  (("Type" ("wifi"))
-   ("Security" (("wep")))
-   ("State" ("idle"))
-   ("Strength" (79))
-   ("Favorite" (nil))
-   ("Immutable" (nil))
-   ("AutoConnect" (nil))
-   ("Name" ("rpi_802.1x"))
-   ("Ethernet"
- ((("Method" ("auto"))
- ("Interface" ("wlan0"))
- ("Address" ("00:26:B6:E6:51:8E"))
- ("MTU" (1500)
-   ("IPv4" (nil))
-   ("IPv4.Configuration" ((("Method" ("dhcp")
-   ("IPv6" (nil))
-   ("IPv6.Configuration" ((("Method" ("auto")) ("Privacy" ("disabled")
-   ("Nameservers" (nil))
-   ("Nameservers.Configuration" (nil))
-   ("Timeservers" (nil))
-   ("Timeservers.Configuration" (nil))
-   ("Domains" (nil))
-   ("Domains.Configuration" (nil))
-   ("Proxy" (nil))
-   ("Proxy.Configuration" (nil))
-   ("Provider" (nil))
-   )) ("/net/connman/service/wifi_0026b6e6518e_hidden_managed_none" (("Type" 
("wifi")) ("Security" (("none"))) ("State" ("idle")) ("Strength" (79)) 
("Favorite" (nil)) ("Immutable" (nil)) ("AutoConnect" (nil)) ("Ethernet" 
((("Method" ("auto")) ("Interface" ("wlan0")) ("Address" ("00:26:B6:E6:51:8E")) 
("MTU" (1500) ("IPv4" (nil)) ("IPv4.Configuration" ((("Method" ("dhcp") 
("IPv6" (nil)) ("IPv6.Configuration" ((("Method" ("auto")) ("Privacy" 
("disabled") ("Nameservers" (nil)) (" [...]
diff --git a/doc/nm-dbus.txt b/doc/nm-dbus.txt
deleted file mode 100644
index 2d49ab0..000
--- a/doc/nm-dbus.txt
+++ /dev/null
@@ -1,390 +0,0 @@
-NetworkManager:
-
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\;>
-
-  
-
-  
-
-  
-  
-
-  
-  
-  
-
-
-  
-  
-  
-
-
-  
-  
-
-  
-  
-
-  
-
-
-  
-  
-
-
-  
-
-
-  
-
-
-  
-
-
-  
-
-
-  
-  
-  
-  
-  
-
-
-  
-  
-  
-  
-
-
-  
-  
-
-
-  
-
-
-  
-
-
-  
-
-
-  
-
-
-  
-
-
-
-
-
-
-
-
-
-
-
-
-
-  
-  
-  
-  
-  
-
-"
-
-AccessPoint/*:
-
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\;>
-
-  
-
-  
-
-  
-  
-
-  
-  
-  
-
-
-  
-  
-  
-
-
-  
-  
-
-  
-  
-
-  
-
-
-
-
-
-
-
-
-
-
-  
-
-"
-
-Devices/*:
-
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\;>
-
-  
-
-  
-
-  
-  
-
-  
-  
-  
-
-
-  
-  
-  
-
-
-  
-  
-
-  
-  
-
-
-
-  
-  
-  
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  
-  
-
-  
-
-
-  
-
-
-  
-
-
-  
-
-
-  
-
-
-
-
-
-
-
-  
-
-"
-
-AgentManager:
-
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\;>
-
-  
-
-  
-
-  
-  
-
-  
-  
-  
-
-
-  
-  
-  
-
-
-

[elpa] master b8697fd 62/76: Added force parameter to `enwc-load-backend'.

2017-02-23 Thread Ian Dunn
branch: master
commit b8697fd825cb9a1dde03dbaaac9cf9f8a761f93f
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Added force parameter to `enwc-load-backend'.

* enwc-backend.el (enwc-load-backend): Added parameter to force loading of 
backend.
  (enwc-load-default-backend): Accepts parameter to pass to 
`enwc-load-backend'.
---
 lisp/enwc-backend.el | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lisp/enwc-backend.el b/lisp/enwc-backend.el
index 61e78a2..fa4083f 100644
--- a/lisp/enwc-backend.el
+++ b/lisp/enwc-backend.el
@@ -115,11 +115,12 @@ Signals an error if a backend with KEY already exists and 
FORCEP is nil."
 
 ;; Handle loading/unloading
 
-(defun enwc-load-backend (backend)
+(defun enwc-load-backend (backend  force)
   "Load BACKEND, which is a symbol denoting the backend to use."
   (interactive
(list
-(intern (completing-read "Backend: " enwc-registered-backend-alist nil 
t
+(intern (completing-read "Backend: " enwc-registered-backend-alist nil t))
+current-prefix-arg))
   (when (and enwc--current-backend
  (not (eq (enwc-backend-key enwc--current-backend) backend)))
 (enwc-unload-current-backend))
@@ -128,14 +129,13 @@ Signals an error if a backend with KEY already exists and 
FORCEP is nil."
 (unless new-backend
   (error "No registered backend %s" backend))
 
-(unless (enwc--can-load-p new-backend)
-  (error "Backend %s is not usable." backend))
-
+(if (not (or force (enwc--can-load-p new-backend)))
+  (warn "Backend %s is not usable." backend)
 (enwc--load new-backend)
-(setq enwc--current-backend new-backend)))
+(setq enwc--current-backend new-backend
 
-(defun enwc-load-default-backend ()
-  (enwc-load-backend enwc-default-backend))
+(defun enwc-load-default-backend ( force)
+  (enwc-load-backend enwc-default-backend force))
 
 (defun enwc-unload-current-backend ()
   "Unload the current backend."



[elpa] master a3c59cc 74/76: Updated version to 2.0beta1

2017-02-23 Thread Ian Dunn
branch: master
commit a3c59cce3482babc7c0518e7ff9da246158b9420
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Updated version to 2.0beta1
---
 enwc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/enwc.el b/enwc.el
index f5b065e..4728e93 100644
--- a/enwc.el
+++ b/enwc.el
@@ -4,7 +4,7 @@
 
 ;; Author: Ian Dunn <du...@gnu.org>
 ;; Keywords: external, network, wicd, manager, nm
-;; Version: 2.0
+;; Version: 2.0beta1
 ;; Package-Requires: ((emacs "25.1"))
 ;; Homepage: https://savannah.nongnu.org/p/enwc
 



[elpa] master c6585bb 47/76: Added autoloads

2017-02-23 Thread Ian Dunn
branch: master
commit c6585bb477ff62a02bc894a04bc1ee67a6b1ff3d
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Added autoloads
---
 Makefile   |  3 +++
 lisp/Makefile  |  7 ++-
 lisp/enwc-setup.el |  2 +-
 lisp/enwc.el   | 43 +--
 4 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/Makefile b/Makefile
index 81495bf..9c7fa1b 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,9 @@ all: lisp
 lisp:
$(MAKE) -C $(LISPDIR)
 
+autoloads:
+   $(MAKE) -C $(LISPDIR) enwc-autoloads.el
+
 install:
install -m 644 $(ALLELC) $(SITELISP)
install -m 644 $(ALLSRC) $(SITELISP)
diff --git a/lisp/Makefile b/lisp/Makefile
index c3a0ad5..9e33203 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -28,8 +28,13 @@ all: $(TARGET)
 
 %.elc: %.el
@$(EMACS) -q --batch \
-   --eval "(add-to-list 'load-path \".\")" \
+   -L "." \
-f batch-byte-compile $<
 
+enwc-autoloads.el:
+   @$(EMACS) -q --batch \
+   --eval "(require 'package)" \
+   --eval "(package-generate-autoloads \"enwc\" \"$$(pwd)\")"
+
 clean:
-rm -f *.elc
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index a3d0984..053b941 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -22,7 +22,6 @@
 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 ;; 02110-1301, USA.
 
-
 (require 'enwc)
 (require 'enwc-wicd)
 (require 'enwc-nm)
@@ -93,6 +92,7 @@
  )
 (funcall (intern (concat "enwc-" sym-name "-setup")
 
+;;;###autoload
 (defun enwc-setup ()
   "Sets up ENWC.
 This setups ENWC and confirms that one of the backends can be found
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 5308e2b..69c81d0 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -45,8 +45,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(require 'cl-lib)
 
 (defgroup enwc nil
   "*The Emacs Network Client"
@@ -262,12 +261,12 @@ whether or not ENWC is in wired mode.")
 (defun enwc-detail-to-ident (detail)
   "Converts detail DETAIL to a constant identifier."
   (case (intern detail)
-((essid Ssid) "essid")
-((bssid HwAddress) "bssid")
-((quality Strength) "quality")
-((encryption Flags) "encryption")
-((mode Mode) "mode")
-((channel Frequency) "channel")))
+((essid Ssid) "essid")
+((bssid HwAddress) "bssid")
+((quality Strength) "quality")
+((encryption Flags) "encryption")
+((mode Mode) "mode")
+((channel Frequency) "channel")))
 
 
 ;; ENWC functions
@@ -314,7 +313,9 @@ network with id ID."
 (defun enwc-wireless-connect (id)
   "Begins a connection to wireless network with
 id ID."
-  (funcall enwc-wireless-connect-func id))
+  (funcall enwc-wireless-connect-func id)
+  ;; (run-hooks 'enwc-on-connected-hook)
+  )
 
 (defun enwc-wireless-disconnect ()
   "Disconnects the wireless."
@@ -412,7 +413,7 @@ If no network is connected, then prints 0%.
 If wired is active, then prints 100%.
 If ENWC is in the process of connecting, then prints *%.
 This is initiated during setup, and runs once every second."
- (let ((cur-id (enwc-get-current-nw-id))
+  (let ((cur-id (enwc-get-current-nw-id))
(conn (enwc-check-connecting-p))
str)
 (setq str
@@ -486,7 +487,7 @@ the scan results."
 (setq enwc-essid-width (1+ enwc-essid-width))
 (setq enwc-scan-done t)
 (if enwc-scan-interactive
- (enwc-display-wireless-networks enwc-last-scan
+(enwc-display-wireless-networks enwc-last-scan
 
 (defun enwc-scan-internal-wired ()
   "The scanning routine for a wired connection.
@@ -541,7 +542,7 @@ ENT is the entry, and WIDTH is the column width."
 NETWORKS must be in the format returned by
 `enwc-scan-internal-wireless'."
   (if (not (eq major-mode 'enwc-mode))
-  (enwc-setup-buffer))
+  (enwc-setup-buffer))
   (if (not (listp networks))
   (error "NETWORKS must be a list of association lists."))
   (let ((cur-id (enwc-get-current-nw-id))
@@ -590,6 +591,7 @@ functions, and checks whether or not ENWC is using wired."
   (enwc-display-wired-networks networks)
 (enwc-display-wireless-networks networks)))
 
+;;;###autoload
 (defun enwc-scan ()
   "The frontend of the scanning routine.  Sets up and moves to
 the ENWC buffer if necessary, and scans and displays the networks."
@@ -605,6 +607,7 @@ the ENWC buffer if necessary, and scans and displays the 
networks."
  (forward-line))
  (enwc-scan-internal)
 
+;;;###autoload
 (defun enwc-find-network (essid  networks)
   "Checks through NETWORKS for the network 

[elpa] master 4462fba 56/76: Lots of changes to enwc.el.

2017-02-23 Thread Ian Dunn
branch: master
commit 4462fba3d0ab158afb38e69be3790e2bc2fbdcd5
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Lots of changes to enwc.el.

* enwc.el (enwc-backends): Removed.
  (enwc-current-backend): Removed.
  (enwc-print-strength): Use simple `format' call.
  (enwc-details-list): Created to replace `enwc-details-alist'.
  (enwc-details-alist): Removed.
  (enwc-update-width): Removed.
  (enwc-refresh-widths): Use `enwc-details-list'.
  (enwc--get-details, enwc--tabulated-list-entries, 
enwc--tabulated-list-printer):
   New functions for use with tabulated-list-mode
  (enwc-display-wired-networks): Use new functions and `enwc-details-list'.
  (enwc-ensure-buffer): Helper function to ensure that ENWC buffer exists.

Moved all editing functions to enwc-edit.el.
---
 .hgignore|   2 +
 lisp/enwc.el | 660 ++-
 2 files changed, 106 insertions(+), 556 deletions(-)

diff --git a/.hgignore b/.hgignore
index b905ccf..284f56b 100644
--- a/.hgignore
+++ b/.hgignore
@@ -1,2 +1,4 @@
+syntax: glob
+
 lisp/*.elc
 lisp/enwc-autoloads.el
\ No newline at end of file
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 52bbce3..8a5e89a 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -45,13 +45,15 @@
 
 ;;; Code:
 
-(require 'dbus)
-(require 'wid-edit)
+(require 'enwc-backend)
+
 (require 'tabulated-list)
 (require 'cl-lib)
 (require 'cl-macs)
 (require 'format-spec)
+
 (require 'map)
+(require 'seq)
 
 (defgroup enwc nil
   "*The Emacs Network Client"
@@ -68,13 +70,6 @@
   :group 'enwc
   :type 'string)
 
-(defcustom enwc-backends '(wicd nm)
-  "The list of backends to be used by ENWC.
-These will be checked in the order designated here,
-and the first active backend found will be used."
-  :group 'enwc
-  :type 'list)
-
 (defcustom enwc-display-mode-line 't
   "Non-nil means display network information in the mode line.
 The specific information can be set using `enwc-mode-line-format'."
@@ -114,43 +109,25 @@ connection.
 
 ;;; The function variables for the abstract layer.
 
-(defvar enwc-current-backend nil
-  "The backend that ENWC is currently using.
-
-Do not set this directly.  Instead, use `enwc-load-backend'.")
-
 (defvar enwc-display-string " [0%] "
   "The mode line display string.
 This is altered every second to display the current network strength
 in `enwc-update-mode-line'.")
 
-(defun enwc-print-strength (s)
+(defun enwc--print-strength (s)
   "Convert signal strength S to a string to dispay."
-  (concat (number-to-string s) "%"))
-
-(defvar enwc-details-alist
-  `((strength . ((display . "Str")
- (width   . 0)
- (conv. enwc-print-strength)))
-(essid. ((display . "Essid")
- (width   . 0)
- (conv. identity)))
-(encrypt  . ((display . "Encrypt")
- (width   . 0)
- (conv. identity)))
-(bssid. ((display . "Bssid")
- (width   . 0)
- (conv. identity)))
-(channel  . ((display . "Chnl")
- (width   . 0)
- (conv. identity
-  "Alist of the details to their information.
-
-The information entries themselves are an alist, with the following keys:
-
-DISPLAY is the display name.
-WIDTH is used during display to keep track of the width of each one.
-CONV is the conversion function used during display.")
+  (format "%s%%" s))
+
+(cl-defstruct enwc-column-spec ()
+  detail display width conv)
+
+(defvar enwc-details-list
+  (list
+   (make-enwc-column-spec :detail 'strength :display "Str" :conv 
#'enwc--print-strength)
+   (make-enwc-column-spec :detail 'essid:display "Essid"   :conv 
#'identity)
+   (make-enwc-column-spec :detail 'encrypt  :display "Encrypt" :conv 
#'identity)
+   (make-enwc-column-spec :detail 'bssid:display "Bssid"   :conv 
#'identity)
+   (make-enwc-column-spec :detail 'channel  :display "Channel" :conv 
#'identity)))
 
 (defvar enwc-last-scan nil
   "The most recent scan results.
@@ -162,7 +139,7 @@ This will be an association list of the form:
 Each ID is a backend-specific network ID.
 
 Each key in the children association lists corresponds to an entry in
-`enwc-details-alist'.")
+`enwc-details-list'.")
 
 (defvar enwc-access-points nil
   "The most recent access point list.")
@@ -196,7 +173,7 @@ This is only used internally.")
 
 ;; The Faces
 
-(defface enwc-header-face
+(defface enwc-header
   'class color) (background light))
  (:foreground "Blue"))
 (((class color) (background dark))
@@ -205,7 +182,7 @@ This is only used internally.")
   "The face for the headers."
   :grou

[elpa] master 8f21449 45/76: Removed tag 2.0

2017-02-23 Thread Ian Dunn
branch: master
commit 8f2144928f7c477980ec2c724f7f565d3d83259f
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Removed tag 2.0
---
 .hgtags | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.hgtags b/.hgtags
index 25999b2..820ec4a 100644
--- a/.hgtags
+++ b/.hgtags
@@ -1 +1,3 @@
 3e2cab525cbc1c8664207fe9c01978335911b0a3 2.0
+3e2cab525cbc1c8664207fe9c01978335911b0a3 2.0
+ 2.0



[elpa] master 2c298fc 70/76: Updated copyright and keywords on all files.

2017-02-23 Thread Ian Dunn
branch: master
commit 2c298fc7954bd801884cce38ba8f5701434400e7
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Updated copyright and keywords on all files.
---
 lisp/enwc-backend.el | 2 +-
 lisp/enwc-cm.el  | 4 ++--
 lisp/enwc-edit.el| 4 
 lisp/enwc-nm.el  | 4 ++--
 lisp/enwc-wicd.el| 4 ++--
 lisp/enwc.el | 2 +-
 6 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lisp/enwc-backend.el b/lisp/enwc-backend.el
index a296477..312066e 100644
--- a/lisp/enwc-backend.el
+++ b/lisp/enwc-backend.el
@@ -1,6 +1,6 @@
 ;;; enwc-backend.el --- Back-end functions for ENWC.
 
-;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn <du...@gnu.org>
 ;; Keywords: external, network, wicd, manager, nm
diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
index cce89d7..0ba0470 100644
--- a/lisp/enwc-cm.el
+++ b/lisp/enwc-cm.el
@@ -1,9 +1,9 @@
 ;; enwc-cm.el --- The ConnMan back-end to ENWC.
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn <du...@gnu.org>
-;; Keywords: network, wicd, manager, nm
+;; Keywords: external, network, wicd, manager, nm
 ;; Version: 2.0
 ;; Homepage: https://savannah.nongnu.org/p/enwc
 
diff --git a/lisp/enwc-edit.el b/lisp/enwc-edit.el
index 6f2a587..7aee28b 100644
--- a/lisp/enwc-edit.el
+++ b/lisp/enwc-edit.el
@@ -1,5 +1,7 @@
 ;;; enwc-edit.el --- Support for editing wireless network profiles
 
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
 ;; Author: Ian Dunn <du...@gnu.org>
 ;; Keywords: external, network, wicd, manager, nm
 ;; Version: 2.0
@@ -24,6 +26,8 @@
 
 ;;; Commentary:
 
+;; THIS IS EXPERIMENTAL
+
 ;;; Code:
 
 (require 'wid-edit)
diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 04e1813..b3275e0 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -1,9 +1,9 @@
 ;;; enwc-nm.el - The NetworkManager backend to ENWC
 
-;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn <du...@gnu.org>
-;; Keywords: network, wicd, manager, nm
+;; Keywords: external, network, wicd, manager, nm
 ;; Version: 2.0
 ;; Homepage: https://savannah.nongnu.org/p/enwc
 
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index b321c00..011f91e 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -1,9 +1,9 @@
 ;;; enwc-wicd.el --- The Wicd backend to ENWC
 
-;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn <du...@gnu.org>
-;; Keywords: network, wicd, manager, nm
+;; Keywords: external, network, wicd, manager, nm
 ;; Version: 2.0
 ;; Homepage: https://savannah.nongnu.org/p/enwc
 
diff --git a/lisp/enwc.el b/lisp/enwc.el
index dfd2511..f5b065e 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -1,6 +1,6 @@
 ;;; enwc.el --- The Emacs Network Client
 
-;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn <du...@gnu.org>
 ;; Keywords: external, network, wicd, manager, nm



[elpa] master 59ca546 20/76: (enwc--str-to-sym): Fixed.

2017-02-23 Thread Ian Dunn
branch: master
commit 59ca54619590fd7d1c1d12261cc5e153b7d7950e
Author: Ian D 
Commit: Ian D 

(enwc--str-to-sym): Fixed.
(enwc-profile-props-widget): Added indentation.
(enwc--make-supplicant-multi): Added indentation.
(enwc--make-supplicant-choice): Added indentation and fixed button.
(enwc--make-supplicant-list): Added indentation.
(enwc-supplicant-alist): Added default parameters for phase lists.
(enwc-supplicant-template-alist): Fixed default parameters for phase lists.
(enwc--get-supplicant-entry): Fixed initialization values for lists.
(enwc-create-template-menu): Added indentation.
---
 lisp/enwc.el | 83 ++--
 1 file changed, 47 insertions(+), 36 deletions(-)

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 1ebca2f..70d6b28 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -237,32 +237,30 @@ This is only used internally.")
   "The face for the connected network."
   :group 'enwc)
 
-;; Necessary for the macros used later.
-(eval-when-compile
-  (defun enwc--break-by-words (str)
-"Break up string STR into a list of words."
-(cl-check-type str string)
-(split-string str "-\\|_"))
-
-  (defun enwc--sym-to-str (sym  seps)
-"Create a string from symbol SYM.
+(defun enwc--break-by-words (str)
+  "Break up string STR into a list of words."
+  (cl-check-type str string)
+  (split-string str "-\\|_\\| "))
+
+(defun enwc--sym-to-str (sym  seps)
+  "Create a string from symbol SYM.
 SEPS is a string specifying the separator to use to combine the words,
 or \" \" if not specified."
-(cl-check-type sym symbol)
-(unless seps
-  (setq seps " "))
-(cl-check-type seps string)
-(combine-and-quote-strings (enwc--break-by-words (symbol-name sym)) seps))
-
-  (defun ewnc--str-to-sym (str  seps)
-"Create a symbol from the string STR.
+  (cl-check-type sym symbol)
+  (unless seps
+(setq seps " "))
+  (cl-check-type seps string)
+  (combine-and-quote-strings (enwc--break-by-words (symbol-name sym)) seps))
+
+(defun enwc--str-to-sym (str  seps)
+  "Create a symbol from the string STR.
 This will break STR into words, and then put it back together separating
 each word by SEPS, which defaults to \"-\"."
-(cl-check-type str string)
-(unless seps
-  (setq seps "-"))
-(cl-check-type seps string)
-(intern (combine-and-quote-strings (enwc--break-by-words str) seps
+  (cl-check-type str string)
+  (unless seps
+(setq seps "-"))
+  (cl-check-type seps string)
+  (intern (combine-and-quote-strings (enwc--break-by-words str) seps)))
 
 
 ;; ENWC functions ;;
@@ -733,6 +731,7 @@ This is mostly useful to view the text of the hidden 
entries."
   :value-to-internal 'enwc-profile-props-to-widget
   :value-to-external 'enwc-widget-to-profile-props
   :match #'(lambda nil t)
+  :indent 1
   :args '((string :tag "Address")
   (string :tag "Netmask")
   (string :tag "Gateway")
@@ -769,6 +768,7 @@ This is mostly useful to view the text of the hidden 
entries."
  (quote (checklist :tag ,(capitalize (enwc--sym-to-str key))
:format "%{%t%}: %v"
:sample-face bold
+   :indent ,(+ 4 (length (enwc--sym-to-str key)))
:args ,(mapcar
(lambda (arg)
  `(item :tag ,arg :value ,(downcase arg)))
@@ -777,12 +777,13 @@ This is mostly useful to view the text of the hidden 
entries."
 (defmacro enwc--make-supplicant-choice (key  args)
   `(cons (quote ,key)
  (quote (menu-choice :tag ,(capitalize (enwc--sym-to-str key))
- :format "%{%t%}: %v"
- :sample-face bold
- ,@(mapcar
-(lambda (arg)
-  `(item :tag ,(downcase arg) :value ,arg))
-args)
+ :format "%[%t%]: %v"
+ :sample-face bold
+ :args
+ ,(mapcar
+   (lambda (arg)
+ `(item :tag ,(downcase arg) :value 
,arg))
+   args)
 
 (defmacro enwc--make-supplicant-secret (key)
   `(cons (quote ,key)
@@ -810,7 +811,8 @@ This is mostly useful to view the text of the hidden 
entries."
  (quote (list :tag ,(capitalize (enwc--sym-to-str key))
   :format "%{%t%}: %v"
   :sample-face bold
-  ,@(mapcar 'cdr args)
+  :indent ,(length (enwc--sym-to-str key))
+  :args ,(mapcar (lambda (x) (cdr (eval x))) args)
 
 (defconst enwc-supplicant-alist
   (list
@@ -835,12 

[elpa] master ee90297 31/76: (enwc-nm.el): Fixed several docstrings, and file header.

2017-02-23 Thread Ian Dunn
branch: master
commit ee90297fcf3d6f77a8a2d24f7c82e331107becbf
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

(enwc-nm.el): Fixed several docstrings, and file header.
(enwc-nm-access-point-added-signal, enwc-nm-access-point-removed-signal, 
enwc-nm-properties-changed-signal, enwc-nm-wired-state-changed-signal, 
enwc-nm-state-changed-signal): New variables.
(enwc-nm-setup): Set the signal variables.
(enwc-nm-unload): New function to unload the NM back-end.
---
 lisp/enwc-nm.el | 155 ++--
 1 file changed, 83 insertions(+), 72 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index b349a80..8289d02 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -1,28 +1,29 @@
 ;;; enwc-nm.el - The NetworkManager backend to ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
 
-;; Author: Ian Dunn
-;; Keywords: enwc, network, wicd, manager, nm
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
 
-;; This file is part of ENWC
+;; This file is part of GNU Emacs.
 
-;; ENWC is free software; you can redistribute it and/or modify it
+;; GNU Emacs is free software; you can redistribute it and/or modify it
 ;; under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
-;; ENWC is distributed in the hope that it will be useful, but WITHOUT
+;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 ;; License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with ENWC; see the file COPYING.  If not, write to the Free
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 ;; 02110-1301, USA.
 
-
 ;;; Commentary:
 ;;
 ;;   This requires NetworkManager >= 0.9.6
@@ -108,6 +109,23 @@
 (defvar enwc-nm-edit-info nil
   "The information for the network connection being edited.")
 
+;; D-Bus Signals:
+
+(defvar enwc-nm-access-point-added-signal nil
+  "D-Bus signal object for the \"AccessPointAdded\" signal.")
+
+(defvar enwc-nm-access-point-removed-signal nil
+  "D-Bus signal object for the \"AccessPointRemoved\" signal.")
+
+(defvar enwc-nm-properties-changed-signal nil
+  "D-Bus signal object for the \"PropertiesChanged\" signal.")
+
+(defvar enwc-nm-wired-state-changed-signal nil
+  "D-Bus signal object for the \"StateChanged\" signal for the wired device.")
+
+(defvar enwc-nm-state-changed-signal nil
+  "D-Bus signal object for the \"StateChanged\" signal for the default path.")
+
 (defun enwc-nm-dbus-call-method (method  path interface  args)
   (unless path (setq path enwc-nm-dbus-path))
   (unless interface (setq interface enwc-nm-dbus-interface))
@@ -144,8 +162,7 @@
  args))
 
 (defun enwc-nm-get-settings (conn)
-  "Gets the connection settings.
-CONN is an object path to the connection."
+  "Get the connection settings from CONN."
   (enwc-nm-dbus-call-method "GetSettings" conn
 enwc-nm-dbus-connections-interface))
 
@@ -243,7 +260,7 @@ This gets the connection path from NW, and connects to it."
 
 
 ;; Get network properties ;;
-;;;
+
 
 (defun enwc-nm-get-wireless-network-property (nw prop)
   "The NetworkManager get wireless network property function.
@@ -262,7 +279,7 @@ PROP from that access point.  It also sets the channel from 
the
   (1+ (/ (- freq 2412) 5)))
 
 (defun enwc-nm-get-wireless-nw-props (nw)
-  "Gets the network properties for the network NW."
+  "Get the network properties for the network NW."
   (let ((props (dbus-get-all-properties :system
 enwc-nm-dbus-service
 nw
@@ -285,9 +302,9 @@ If both are 0, then it returns WEP, otherwise WPA."
 "WEP"
   "WPA")))
 
-;;;
-;; Get Current network id
-;;;
+
+;; Get Current network id ;;
+
 
 (defun enwc-nm-wireless-prop-changed (props)
   "Called when network properties are changed.
@@ -319,14 +336,9 @@ If STATE is 40, then NetworkManager is connecting to a new 
AP."
   "The NetworkManager check connecting function."
   enwc-nm-connecting-p)
 
-;; Setting

[elpa] master 5088938 40/76: Removed erroneous comment.

2017-02-23 Thread Ian Dunn
branch: master
commit 50889387cdd66ba9f3fa883f4eea7217712e1610
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Removed erroneous comment.
---
 lisp/enwc-cm.el | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
index 975c9f9..965992c 100644
--- a/lisp/enwc-cm.el
+++ b/lisp/enwc-cm.el
@@ -44,9 +44,6 @@
   :group 'enwc-cm
   :type 'string)
 
-
-;; DEMAND TO SEE LIFE'S MANAGER!!
-
 (defcustom enwc-cm-dbus-manager-interface "net.connman.Manager"
   "ConnMan D-Bus Manager interface."
   :group 'enwc-cm



[elpa] master 1722c02 33/76: enwc-cm.el: Fixed up header and footer.

2017-02-23 Thread Ian Dunn
branch: master
commit 1722c025f2c1997942c842d0be26ff965ab8bd06
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

enwc-cm.el: Fixed up header and footer.
---
 lisp/enwc-cm.el | 33 ++---
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
index 2b54e44..cce89d7 100644
--- a/lisp/enwc-cm.el
+++ b/lisp/enwc-cm.el
@@ -1,35 +1,34 @@
-;; enwc-cm.el
+;; enwc-cm.el --- The ConnMan back-end to ENWC.
 
 ;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
-;; Author: Ian Dunn
-;; Keywords: enwc, network, wicd, manager, nm
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
 
-;; This file is part of ENWC
+;; This file is part of GNU Emacs
 
-;; ENWC is free software; you can redistribute it and/or modify it
+;; GNU Emacs is free software; you can redistribute it and/or modify it
 ;; under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
-;; ENWC is distributed in the hope that it will be useful, but WITHOUT
+;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 ;; License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with ENWC; see the file COPYING.  If not, write to the Free
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 ;; 02110-1301, USA.
 
-;; connect
-;; disconnect
-;; scan
-;; get-prop
-;; save-profile
-;; get-networks
-;; check-connecting
-;; get-current-nw-id
+;;; Commentary:
+
+;; ConnMan support is still experimental.
+
+;;; Code:
 
 (require 'enwc)
 
@@ -363,3 +362,7 @@ METHOD is assumed to be the camel-case D-Bus method."
 ;;  new-ipv4-config)
 ;; (enwc-cm-set-nw-prop wired id "Nameservers.Configuration"
 ;;  new-dns-config)))
+
+(provide 'enwc-cm)
+
+;;; enwc-cm.el ends here



[elpa] master 421b0d9 35/76: (enwc-wicd-setup): Renamed to `enwc-wicd-load'.

2017-02-23 Thread Ian Dunn
branch: master
commit 421b0d9d8c5dac9ea6434520bf0273ef0acbd0bf
Author: Ian D 
Commit: Ian D 

(enwc-wicd-setup): Renamed to `enwc-wicd-load'.
(enwc-nm-setup): Renamed to `enwc-nm-load'.
---
 lisp/enwc-nm.el   | 4 ++--
 lisp/enwc-wicd.el | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 8289d02..ed4c625 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -524,7 +524,7 @@ to put it in the form that NetworkManager will recognize."
 (setq conn-settings (enwc-nm-process-profile-info conn-settings settings))
 (enwc-nm-finalize-settings conn-settings)))
 
-(defun enwc-nm-setup ()
+(defun enwc-nm-load ()
   "Setup the NetworkManager back-end."
   (setq enwc-nm-wired-dev (enwc-nm-get-device-by-name enwc-wired-device)
 enwc-nm-wireless-dev (enwc-nm-get-device-by-name enwc-wireless-device))
@@ -606,4 +606,4 @@ Unregister all of the D-Bus signals set up during load."
 
 (provide 'enwc-nm)
 
-;;; End of File.
+;;; enwc-nm.el ends here
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index 27a202e..69babdb 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -410,7 +410,7 @@ WIRED indicates whether or not ID is a wired connection."
  (caar (nthcdr 3 info))
  (string-to-number (caar (nthcdr 3 
info
 
-(defun enwc-wicd-setup ()
+(defun enwc-wicd-load ()
   "Setup the Wicd backend."
   ;; Thanks to Michael Albinus for pointing out this signal.
   (setq enwc-wicd-end-scan-signal
@@ -438,4 +438,4 @@ Unregister all of the D-Bus signals set up during load."
 
 (provide 'enwc-wicd)
 
-;;; End of File
+;;; enwc-wicd.el ends here.



[elpa] master ba6061b 51/76: Created more robust backend system.

2017-02-23 Thread Ian Dunn
branch: master
commit ba6061b886e549b9170a234f27722e5721948f92
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Created more robust backend system.
---
 lisp/enwc-backend.el | 148 +++
 lisp/enwc-setup.el   |  84 -
 2 files changed, 148 insertions(+), 84 deletions(-)

diff --git a/lisp/enwc-backend.el b/lisp/enwc-backend.el
new file mode 100644
index 000..e79b8d2
--- /dev/null
+++ b/lisp/enwc-backend.el
@@ -0,0 +1,148 @@
+;;; enwc-backend.el --- Back-end functions for ENWC.
+
+;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'map)
+
+(cl-defstruct enwc-backend
+  key  ;; The symbol that identifies this backend.
+  ;; Loading/unloading functions
+  can-load-p
+  load
+  unload
+  ;; Scan interface
+  network-ids
+  scan
+  wireless-nw-props
+  ;; Connect/disconnect
+  connect
+  disconnect
+  ;; Maintenance
+  current-nw-id
+  is-connecting-p
+  is-wired-p
+  ;; get-profile-info
+  ;; save-nw-settings
+  )
+
+(defvar enwc-registered-backend-alist nil
+  "Alist of registered ENWC backends.
+
+Each entry in this list is of the form
+
+(KEY . DEFINITION)
+
+Where KEY is a symbol identifying the backend, and DEFINITION is
+an enwc-backend struct.")
+
+(defcustom enwc-default-backend nil
+  "Key of the default backend to use."
+  :type 'symbol
+  :group 'enwc)
+
+(defvar enwc--current-backend nil)
+
+(defun enwc-register-backend (definition  forcep)
+  "Register the backend KEY with DEFINITION.
+
+Signals an error if a backend with KEY already exists and FORCEP is nil."
+  (cl-check-type definition enwc-backend)
+  (let ((key (enwc-backend-key definition)))
+(when (and (map-contains-key enwc-registered-backend-alist key) (not 
forcep))
+  (error "An ENWC backend with key '%s' has already been registered." key))
+(map-put enwc-registered-backend-alist key definition)))
+
+;; Convenience functions to work with backends
+
+(defun enwc--can-load-p (backend)
+  (funcall (enwc-backend-can-load-p backend)))
+
+(defun enwc--load (backend)
+  (funcall (enwc-backend-load backend)))
+
+(defun enwc--unload (backend)
+  (funcall (enwc-backend-unload backend)))
+
+(defun enwc--scan (backend)
+  (funcall (enwc-backend-scan backend)))
+
+(defun enwc--network-ids (backend)
+  (funcall (enwc-backend-network-ids backend)))
+
+(defun enwc--wireless-nw-props (backend id)
+  (funcall (enwc-backend-wireless-nw-props backend) id))
+
+(defun enwc--connect (backend id  wired-p)
+  (funcall (enwc-backend-connect backend) id wired-p))
+
+(defun enwc--disconnect (backend  wired-p)
+  (funcall (enwc-backend-disconnect backend) wired-p))
+
+(defun enwc--current-nw-id (backend  wired-p)
+  (funcall (enwc-backend-current-nw-id backend) wired-p))
+
+(defun enwc--is-connecting-p (backend)
+  (funcall (enwc-backend-is-connecting-p backend)))
+
+(defun enwc--is-wired-p (backend)
+  (funcall (enwc-backend-is-wired-p backend)))
+
+;; Handle loading/unloading
+
+(defun enwc-load-backend (backend)
+  "Load BACKEND, which is a symbol denoting the backend to use."
+  (interactive
+   (list
+(intern (completing-read "Backend: " enwc-registered-backend-alist nil 
t
+  (when (and enwc--current-backend
+ (not (eq (enwc-backend-key enwc--current-backend) backend)))
+(enwc-unload-current-backend))
+
+  (let ((new-backend (map-elt enwc-registered-backend-alist backend)))
+(unless new-backend
+  (error "No registered backend %s" backend))
+
+(unless (enwc--can-load-p new-backend)
+  (error "Backend %s is not usable." backend))
+
+(enwc--load new-backend)
+(setq enwc--current-backend new-backend)))
+
+(defun enwc-load-default-backend ()
+  (enwc-load-backend (map-elt enwc-registered-backend-alist 
enwc-default-backend)))
+
+(defun enwc-unload-current-backend ()
+  "Unload the current backend."
+  (when enwc--current-backend
+(enwc--

[elpa] master d9cbdb9 39/76: Added some section headers.

2017-02-23 Thread Ian Dunn
branch: master
commit d9cbdb91db59321a902f4d2d4caa47ce82b5b280
Author: Ian D 
Commit: Ian D 

Added some section headers.
(enwc-nm-dbus-settings-groups): Added new variable.
(enwc-nm--ap-to-conn, enwc-nm-connection-p): Added new function.
(enwc-nm-get-wireless-nw-props): Fixed typo in HwAddress.
(enwc-nm--recurse-dbus-entry): Added to help with 
`enwc-nm-set-dbus-dict-entry'.
(enwc-nm-set-dbus-dict-entry): Uses `enwc-nm--recurse-dbus-entry'.
(enwc-nm-process-profile-info): Began fixing.
(enwc-nm-get-profile-info): Added new function.
(enwc-nm-finalize-settings): Added doc-string.
(enwc-nm-setup-settings): Implemented new functions.
---
 lisp/enwc-nm.el| 181 ++---
 lisp/enwc-setup.el |   4 +-
 lisp/enwc.el   |  11 +++-
 3 files changed, 142 insertions(+), 54 deletions(-)

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index ed4c625..b6499ce 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -91,6 +91,26 @@
   :group 'enwc-nm
   :type 'string)
 
+;;TODO: Make this customizable.
+(defconst enwc-nm-dbus-settings-groups
+  '(("802-11-wireless-security" . ("name"
+   "key-mgmt"
+   "wep-tx-keyidx"
+   "auth-alg"
+   "proto"
+   "pairwise"
+   "group"
+   "leap-username"
+   "wep-key0"
+   "wep-key1"
+   "wep-key2"
+   "wep-key3"
+   "wep-key-type"
+   "psk"
+   "leap-password"))
+("ipv4" . ("addresses"
+   "dns"
+
 (defvar enwc-nm-wired-dev nil
   "The wired device object path.")
 
@@ -174,6 +194,31 @@
 (defun enwc-nm-get-device-by-name (name)
   (enwc-nm-dbus-default-call-method "GetDeviceByIpIface" :string name))
 
+(defun enwc-nm--ap-to-conn (ap)
+  "Get the connection that corresponds to AP."
+  (let ((ssid (dbus-byte-array-to-string (enwc-nm-get-wireless-network-property
+  ap "Ssid")))
+(conns (enwc-nm-list-connections))
+conn)
+(while (and conns (not conn))
+  (setq conn (pop conns))
+  (let ((settings (enwc-nm-get-settings conn)))
+(if settings
+(let ((this-ssid (enwc-nm-get-dbus-dict-entry 
"802-11-wireless/ssid"
+  settings)))
+  (unless (and this-ssid
+   (string-equal (dbus-byte-array-to-string this-ssid)
+ ssid))
+(setq conn nil)))
+  (setq conn nil
+conn))
+
+(defun enwc-nm-connection-p (conn)
+  "Return non-nil if CONN is a connection object."
+  (and conn
+   (stringp conn)
+   (string-match "^/org/freedesktop/NetworkManager/Settings/[0-9]+$" 
conn)))
+
 ;;
 ;; Get networks ;;
 ;;
@@ -286,7 +331,7 @@ PROP from that access point.  It also sets the channel from 
the
 enwc-nm-dbus-accesspoint-interface)))
 
 `((essid. ,(dbus-byte-array-to-string (cdr (assoc "Ssid" props
-  (bssid. ,(cdr (assoc "HwAddres" props)))
+  (bssid. ,(cdr (assoc "HwAddress" props)))
   (strength . ,(cdr (assoc "Strength" props)))
   (encrypt  . ,(or (enwc-nm-get-encryption-type nw) "Unsecured"))
   (channel  . ,(number-to-string (enwc-nm--freq-to-channel
@@ -342,6 +387,10 @@ If STATE is 40, then NetworkManager is connecting to a new 
AP."
 (defun enwc-nm-is-wired ()
   enwc-nm-wired-p)
 
+;;
+;; Profile Handling ;;
+;;
+
 (defun enwc-nm-gen-uuid ()
   "Generate a UUID."
   (random t)
@@ -398,6 +447,10 @@ PREFIX is an integer <= 32."
 (enwc--htonl (lsh (1- (expt 2 prefix)) (- 32 prefix
 0))
 
+;;
+;; D-Bus Conversion ;;
+;;
+
 (defun enwc-nm-get-dbus-dict-entry (entry dict)
   "Get an entry ENTRY from D-Bus dictionary DICT.
 
@@ -415,38 +468,24 @@ representing another layer in the dictionary."
 (setq cur-ent (cadr cur-ent
 cur-ent))
 
+(defun enwc-nm--recurse-dbus-entry (dict value entries)
+  "Look in DICT for ENTRIES, and set the final one to VALUE."
+  (if (not entries)
+  (setcar dict value)
+(let* ((cur-str (car entries))
+   (cur-ent (assoc cur-str dict)))
+  (unless cur-ent
+(if (equal dict '(nil))
+(setcar dict `(,cur-str (nil)))
+  (nconc dict `((,cur-str (nil)
+(setq cur-ent (assoc cur-str dict)))
+  (enwc-nm--recurse-dbus-entry (cadr cur-ent) value (cdr entries)
+
 (defun 

[elpa] master c30c0d7 38/76: Fixed up a lot of security handling problems.

2017-02-23 Thread Ian Dunn
branch: master
commit c30c0d783642d7ef31fd9bd3358fd9c19fdcf893
Author: Ian D 
Commit: Ian D 

Fixed up a lot of security handling problems.
(enwc-enable-auto-scan, enwc-disable-auto-scan): New functions.
(enwc-toggle-auto-scan): Implements `enwc-enable-auto-scan' and 
`enwc-disable-auto-scan'.
---
 lisp/enwc-wicd.el |  78 ++--
 lisp/enwc.el  | 211 +-
 2 files changed, 156 insertions(+), 133 deletions(-)

diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index 69babdb..3438ee2 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -232,7 +232,7 @@ wireless network with id ID."
   (enwc-wicd-dbus-wireless-call-method "ConnectWireless" id))
 
 (defun enwc-wicd-wired-connect (id)
-  "Connects to the wired network with profile id ID."
+  "Connect to the wired network with profile id ID."
   (let* ((profs (enwc-wicd-get-wired-profiles))
  (prf (nth id profs)))
 (enwc-wicd-dbus-wired-call-method "ReadWiredNetworkProfile" prf)
@@ -252,7 +252,7 @@ wireless network with id ID."
   (enwc-wicd-dbus-wireless-call-method "DisconnectWireless"))
 
 (defun enwc-wicd-wired-disconnect ()
-  "Disconnects from the wired connection."
+  "Disconnect from the wired connection."
   (enwc-wicd-dbus-wired-call-method "DisconnectWired"))
 
 
@@ -274,7 +274,7 @@ so this jut returns the tracked network id."
 ;;
 
 (defun enwc-wicd-check-connecting ()
-  "The Wicd check connecting function."
+  "Return non-nil if currently connecting to a network."
   (enwc-wicd-dbus-wireless-call-method "CheckIfWirelessConnecting"))
 
 ;
@@ -282,14 +282,14 @@ so this jut returns the tracked network id."
 ;
 
 (defun enwc-wicd-is-wired ()
-  "Checks to see if wired is connected."
+  "Return non-nil if connected to a wired network."
   (not (not (enwc-wicd-dbus-wired-call-method "GetWiredIP"
 
-;
-;; Get Profile Info
-;
+;;
+;; Get Profile Info ;;
+;;
 
-(defun enwc-wicd-get-profile-ent (wired id ent)
+(defun enwc-wicd-get-profile-ent (id ent wired)
   "Get profile entry ENT from the network with id ID.
 WIRED is set to indicate whether this is a wired network.
 This function is a wrapper around the *-get-(wired|wireless)-nw-prop
@@ -301,11 +301,11 @@ functions, allowing for a single function that checks for 
wired."
 (defun enwc-wicd-get-profile-info (id  wired)
   "Get the profile for profile ID.
 WIRED is set to indicate whether this is a wired network."
-  (let ((dns-list (enwc-wicd-get-dns wired id))
+  (let ((dns-list (enwc-wicd-get-dns id wired))
 (sec-info (enwc-wicd-get-profile-sec-info id wired)))
-`((addr . ,(enwc-wicd-get-ip-addr wired id))
-  (netmask . ,(enwc-wicd-get-netmask wired id))
-  (gateway . ,(enwc-wicd-get-gateway wired id))
+`((addr . ,(enwc-wicd-get-ip-addr id wired))
+  (netmask . ,(enwc-wicd-get-netmask id wired))
+  (gateway . ,(enwc-wicd-get-gateway id wired))
   (dns1 . ,(nth 0 dns-list))
   (dns2 . ,(nth 1 dns-list))
   ,@sec-info)))
@@ -313,34 +313,36 @@ WIRED is set to indicate whether this is a wired network."
 (defun enwc-wicd-get-profile-sec-info (id  wired)
   "Get the security info for profile with id ID.
 WIRED is set to indicate whether this is a wired network."
-  (mapcar
-   (lambda (ent)
- (cons
-  (car ent)
-  (enwc-wicd-get-profile-ent wired id (symbol-name (car ent)
-   enwc-supplicant-alist))
-
-(defun enwc-wicd-get-ip-addr (wired id)
+  (remq nil
+   (mapcar
+(lambda (ent)
+  (let ((info (enwc-wicd-get-profile-ent wired id (symbol-name (car 
ent)
+(if info
+(cons (car ent) info)
+  nil)))
+enwc-supplicant-alist)))
+
+(defun enwc-wicd-get-ip-addr (id wired)
   "Get the IP Address from the network with id ID.
 Wired is set to indicate whether this is a wired network."
-  (or (enwc-wicd-get-profile-ent wired id "ip") ""))
+  (or (enwc-wicd-get-profile-ent id "ip" wired) ""))
 
-(defun enwc-wicd-get-netmask (wired id)
+(defun enwc-wicd-get-netmask (id wired)
   "Get the Netmask from the network with id ID.
 WIRED is set to indicate whether this is a wired network."
-  (or (enwc-wicd-get-profile-ent wired id "netmask") ""))
+  (or (enwc-wicd-get-profile-ent id "netmask" wired) ""))
 
-(defun enwc-wicd-get-gateway (wired id)
+(defun enwc-wicd-get-gateway (id wired)
   "Get the Gateway from the network with id ID.
 WIRED is set to indicate whether this is a wired network."
-  (or (enwc-wicd-get-profile-ent wired id "gateway") ""))
+  (or (enwc-wicd-get-profile-ent id "gateway" wired) ""))
 
-(defun enwc-wicd-get-dns (wired id)
+(defun enwc-wicd-get-dns (id wired)
   "Get the list of DNS servers from the network with id ID.
 WIRED is set to indicate whether this is a wired network."
-  (list (or (enwc-wicd-get-profile-ent wired id 

[elpa] master dae475f 2/2: Merge commit '8e63abd47ea0cfa00b44b3c2ab81a933dbd9ce93'

2017-02-24 Thread Ian Dunn
branch: master
commit dae475fc65c7aeb7ea6fa96353ffcfeec79b2201
Merge: 917b79e 8e63abd
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Merge commit '8e63abd47ea0cfa00b44b3c2ab81a933dbd9ce93'
---
 packages/enwc/enwc.el | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/packages/enwc/enwc.el b/packages/enwc/enwc.el
index 4728e93..7315092 100644
--- a/packages/enwc/enwc.el
+++ b/packages/enwc/enwc.el
@@ -35,11 +35,16 @@
 ;;
 ;; In order to use this package, add
 ;;
-;; (setq enwc-default-backend 'backend-symbol)
+;; (setq enwc-default-backend BACKEND-SYMBOL)
 ;;
-;; to your .emacs file (or other init file).
+;; where BACKEND-SYMBOL is either 'wicd or 'nm, to your .emacs file (or other 
init
+;; file).
 ;;
 ;; Then you can just run `enwc' to start everything.
+;;
+;; Example:
+;;
+;; (setq enwc-default-backend 'nm)
 
 ;;; TODO:
 ;;



[elpa] master 8e63abd 1/2: Clarified example in enwc.el

2017-02-24 Thread Ian Dunn
branch: master
commit 8e63abd47ea0cfa00b44b3c2ab81a933dbd9ce93
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Clarified example in enwc.el

* enwc.el: Added example config and explained backend symbols
---
 enwc.el | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/enwc.el b/enwc.el
index 4728e93..7315092 100644
--- a/enwc.el
+++ b/enwc.el
@@ -35,11 +35,16 @@
 ;;
 ;; In order to use this package, add
 ;;
-;; (setq enwc-default-backend 'backend-symbol)
+;; (setq enwc-default-backend BACKEND-SYMBOL)
 ;;
-;; to your .emacs file (or other init file).
+;; where BACKEND-SYMBOL is either 'wicd or 'nm, to your .emacs file (or other 
init
+;; file).
 ;;
 ;; Then you can just run `enwc' to start everything.
+;;
+;; Example:
+;;
+;; (setq enwc-default-backend 'nm)
 
 ;;; TODO:
 ;;



[elpa] master 2dad73c 13/13: Merge commit '9893d7f17a2ee7f83587c305c256bd1300995125'

2017-04-15 Thread Ian Dunn
branch: master
commit 2dad73c22f2ac19899a40c68e3f16b2f56d932ae
Merge: c30e4e1 9893d7f
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Merge commit '9893d7f17a2ee7f83587c305c256bd1300995125'
---
 packages/enwc/enwc-backend.el |  10 +-
 packages/enwc/enwc-nm.el  |  87 +--
 packages/enwc/enwc-test.el|  66 +
 packages/enwc/enwc-wicd.el|  12 +-
 packages/enwc/enwc.el | 325 --
 5 files changed, 309 insertions(+), 191 deletions(-)

diff --git a/packages/enwc/enwc-backend.el b/packages/enwc/enwc-backend.el
index 076907f..a8b8f92 100644
--- a/packages/enwc/enwc-backend.el
+++ b/packages/enwc/enwc-backend.el
@@ -39,7 +39,7 @@
   ;; Scan interface
   network-ids
   scan
-  wireless-nw-props
+  nw-props
   ;; Connect/disconnect
   connect
   disconnect
@@ -98,11 +98,11 @@ Signals an error if a backend with KEY already exists and 
FORCEP is nil."
 (defun enwc--scan (backend)
   (funcall (enwc-backend-scan backend)))
 
-(defun enwc--network-ids (backend)
-  (funcall (enwc-backend-network-ids backend)))
+(defun enwc--network-ids (backend  wired-p)
+  (funcall (enwc-backend-network-ids backend) wired-p))
 
-(defun enwc--wireless-nw-props (backend id)
-  (funcall (enwc-backend-wireless-nw-props backend) id))
+(defun enwc--nw-props (backend id  wired-p)
+  (funcall (enwc-backend-nw-props backend) id wired-p))
 
 (defun enwc--connect (backend id  wired-p)
   (funcall (enwc-backend-connect backend) id wired-p))
diff --git a/packages/enwc/enwc-nm.el b/packages/enwc/enwc-nm.el
index b3275e0..391f4ee 100644
--- a/packages/enwc/enwc-nm.el
+++ b/packages/enwc/enwc-nm.el
@@ -197,24 +197,21 @@
 (defun enwc-nm-get-device-by-name (name)
   (enwc-nm-dbus-default-call-method "GetDeviceByIpIface" :string name))
 
-(defun enwc-nm--ap-to-conn (ap)
-  "Get the connection that corresponds to AP."
-  (let ((ssid (dbus-byte-array-to-string (enwc-nm-get-wireless-network-property
-  ap "Ssid")))
-(conns (enwc-nm-list-connections))
-conn)
-(while (and conns (not conn))
-  (setq conn (pop conns))
+(defun enwc-nm--ap-to-conn (nw)
+  "Get the connection that corresponds to NW."
+  (let ((ap-ssid (dbus-byte-array-to-string
+  (enwc-nm-get-wireless-network-property nw "Ssid")))
+(profile-table (make-hash-table :test #'equal)))
+;; Create a hash table of connections, indexed by ssid
+;; TODO: Store this somewhere else
+(dolist (conn (enwc-nm-list-connections))
   (let ((settings (enwc-nm-get-settings conn)))
-(if settings
-(let ((this-ssid (enwc-nm-get-dbus-dict-entry 
"802-11-wireless/ssid"
-  settings)))
-  (unless (and this-ssid
-   (string-equal (dbus-byte-array-to-string this-ssid)
- ssid))
-(setq conn nil)))
-  (setq conn nil
-conn))
+(map-put profile-table
+ (dbus-byte-array-to-string (enwc-nm-get-dbus-dict-entry
+ "802-11-wireless/ssid"
+ settings))
+ conn)))
+(map-elt profile-table ap-ssid)))
 
 (defun enwc-nm-connection-p (conn)
   "Return non-nil if CONN is a connection object."
@@ -222,6 +219,12 @@
(stringp conn)
(string-match "^/org/freedesktop/NetworkManager/Settings/[0-9]+$" 
conn)))
 
+(defun enwc-nm--profile-wired-p (conn)
+  "Return non-nil if CONN is a wired profile."
+  (let ((props (enwc-nm-get-settings conn)))
+(string= (enwc-nm-get-dbus-dict-entry "connection/type" props)
+ "802-3-ethernet")))
+
 ;;
 ;; Get networks ;;
 ;;
@@ -238,19 +241,12 @@ This returns a list of D-Bus paths to the access points."
 
 (defun enwc-nm-get-wired-profiles ()
   (let ((profs-list (enwc-nm-list-connections)))
-(mapcar
- (lambda (x)
-   (let ((props (enwc-nm-get-settings x)))
- (when (string= (enwc-nm-get-dbus-dict-entry "connection/type" props)
-"802-3-ethernet")
-   (enwc-nm-get-dbus-dict-entry "connection/id" props
- profs-list)))
+(cl-remove-if-not #'enwc-nm--profile-wired-p profs-list)))
 
 ;
 ;; Connect ;;
 ;
 
-;; Default
 (defun enwc-nm-connect (nw  wired)
   "The NetworkManager connect function.
 This gets the connection path from NW, and connects to it."
@@ -259,29 +255,11 @@ This gets the connection path from NW, and connects to 
it."
 (enwc-nm-wireless-connect nw)))
 
 (defun enwc-nm-wireless-connect (nw)
-  (let ((ap-ssid (dbus-byte-array-to-string
-  (dbus-get-property :sy

[elpa] master 60d9d90 07/13: Added tests for interface selection

2017-04-15 Thread Ian Dunn
branch: master
commit 60d9d90841b90aa8019b554b5038e21156bedc64
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Added tests for interface selection

* enwc-test.el (enwc-test-select-interface-save): Test for selecting 
interface
  using ip and saving the interface.
  (enwc-test-select-interface-no-save): Test for selecting interface using
  ifconfig and not saving the interface.
---
 enwc-test.el | 66 
 1 file changed, 66 insertions(+)

diff --git a/enwc-test.el b/enwc-test.el
new file mode 100644
index 000..5b3c6f1
--- /dev/null
+++ b/enwc-test.el
@@ -0,0 +1,66 @@
+;;; enwc-test.el --- Tests for ENWC
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <du...@gnu.org>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Package-Requires: ((emacs "25.1"))
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'enwc)
+(require 'ert)
+
+;; Test enwc-setup
+
+(ert-deftest enwc-test-select-interface-save ()
+  ;; Test saving the interfaces and using the ip selection back-end
+  (let ((enwc-interface-list-function 'enwc--ip-interface-list)
+(enwc-ask-to-save-interfaces t)
+;; Temporarily save our changes to a different file
+(custom-file (make-temp-file "enwc-custom-"))
+(enwc-wired-device "")
+(enwc-wireless-device ""))
+(enwc--setup-select-interfaces)
+(should (not (string-empty-p enwc-wired-device)))
+(should (not (string-empty-p enwc-wireless-device)))
+;; Test whether the interfaces were saved
+(let ((enwc-wired-device "")
+  (enwc-wireless-device ""))
+  (load custom-file)
+  (should (not (string-empty-p enwc-wired-device)))
+  (should (not (string-empty-p enwc-wireless-device
+;; Delete our temporary custom file
+(delete-file custom-file)))
+
+(ert-deftest enwc-test-select-interface-no-save ()
+  ;; Test not saving the interfaces and using the ifconfig selection back-end
+  (let ((enwc-interface-list-function 'enwc--ifconfig-interface-list)
+(enwc-ask-to-save-interfaces nil)
+;; Temporarily save our "changes" to a different file
+(custom-file (make-temp-file "enwc-custom-"))
+(enwc-wired-device "")
+(enwc-wireless-device ""))
+(enwc--setup-select-interfaces)
+(should (not (string-empty-p enwc-wired-device)))
+(should (not (string-empty-p enwc-wireless-device)))
+;; Test whether the interfaces were saved
+(let ((enwc-wired-device "")
+  (enwc-wireless-device ""))
+  (load custom-file)
+  (should (string-empty-p enwc-wired-device))
+  (should (string-empty-p enwc-wireless-device)))
+;; Delete our temporary custom file
+(delete-file custom-file)))
+
+(provide 'enwc-test)
+
+;; Local Variables:
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; enwc-test.el ends here



[elpa] master 7f15c06 11/13: Various fixes and improvements

2017-04-15 Thread Ian Dunn
branch: master
commit 7f15c06daf2b546b5eec9a22743d37a2b8cc9756
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Various fixes and improvements

- Docstring fixes
- Move mode-line update
- Auto-scan fixes

* enwc.el (enwc-wireless-device):
  (enwc-wired-device): Mention enwc-setup in docstring
  (enwc-enable-auto-scan-on-startup): Clean up docstring
  (enwc-auto-scan-interval): Clarify docstring
  (enwc-mode-line-format): Clean up docstring
  (enwc-display-string): Mention new update
  (enwc-mode-line-timer, enwc-display-mode-line-timer): Removed
  (enwc-update-mode-line): Only update mode-line string if it's enabled
  (enwc-enable-display-mode-line, enwc-disable-display-mode-line): Don't set
  timer
  (enwc-enable-auto-scan): Check scan interval
  (enwc-redisplay-networks): Update mode-line string
  (enwc--setup-auto-scan): Only check enwc-enable-auto-scan-on-startup, and 
call
  enwc-enable-auto-scan, which handles the other cases
---
 enwc.el | 84 ++---
 1 file changed, 44 insertions(+), 40 deletions(-)

diff --git a/enwc.el b/enwc.el
index 2ac684e..b2131d0 100644
--- a/enwc.el
+++ b/enwc.el
@@ -68,12 +68,18 @@
   :group 'external)
 
 (defcustom enwc-wireless-device ""
-  "The wireless device to use for ENWC."
+  "The wireless device/interface to use for ENWC.
+
+If this is unset when `enwc-setup' is called, the user will be
+prompted for an interface."
   :group 'enwc
   :type 'string)
 
 (defcustom enwc-wired-device ""
-  "The wired device to use for ENWC."
+  "The wired device/interface to use for ENWC.
+
+If this is unset when `enwc-setup' is called, the user will be
+prompted for an interface."
   :group 'enwc
   :type 'string)
 
@@ -86,8 +92,8 @@ The specific information can be set using 
`enwc-mode-line-format'."
 (defcustom enwc-enable-auto-scan-on-startup nil
   "Whether to enable auto-scan during `enwc-setup'.
 
-If non-nil, then ENWC will automatically scan for
-networks every `enwc-auto-scan-interval' seconds.
+If non-nil, ENWC will automatically scan for networks every
+`enwc-auto-scan-interval' seconds.
 
 To enable auto-scan after startup, use `enwc-enable-auto-scan'."
   :group 'enwc
@@ -104,25 +110,31 @@ To enable auto-scan at startup, set
 (defcustom enwc-auto-scan-interval 20
   "The interval between automatic scans.
 
-To make any changes to this variable take effect, use
-`enwc-restart-auto-scan'."
+To make any changes to this variable take effect outside of the
+customization interface, use `enwc-restart-auto-scan'."
   :group 'enwc
   :type 'integer)
 
 (defcustom enwc-mode-line-format " [%s%%] "
-  "The format for displaying the mode line.
+  "The format for displaying information in the mode line.
+
+The following format specifiers display information about the
+current wireless connection:
+
+%s = signal strength
+
+%e = essid
 
-%s = The current signal strength.  If wired, then this is set to 100.
+%b = bssid
 
-%e = The essid of the current network.  If wired, then this set to 'Wired'
+%n = encryption type
 
-%b = The bssid of the current network.  If using a wired connection, then this
-is set to 'Wired'.
+%c = channel
 
-%n = The encryption type of the current network, or 'Wired' if using a wired
-connection.
+When a wired connection is active, signal strength is 100, essid
+and bssid are \"Wired\", and encryption and channel are \"None\".
 
-%c = The channel of the current network, or 'Wired' if using a wired 
connection.
+The following format specifiers are also significant:
 
 %% = A Normal '%'"
   :group 'enwc
@@ -140,8 +152,8 @@ connection.
 
 (defvar enwc-display-string " [0%] "
   "The mode line display string.
-This is altered every second to display the current network strength
-in `enwc-update-mode-line'.")
+
+This is updated after every scan using `enwc-update-mode-line'.")
 
 (defun enwc--print-strength (s)
   "Convert signal strength S to a string to dispay."
@@ -238,14 +250,9 @@ This is used so as to avoid multiple updates of the scan 
data.")
   "This is non-nil that a scan was interactively requested.
 This is only used internally.")
 
-(defvar enwc-display-mode-line-timer nil
-  "The timer that updates the mode line display.")
-
 (defvar enwc-scan-timer nil
   "The timer for automatic scanning.")
 
-(defvar enwc-mode-line-timer nil)
-
 (make-local-variable 'enwc-edit-id)
 
 ;; The Faces
@@ -380,8 +387,9 @@ See the documentation for it for more details."
   "Update the mode line display.
 This uses the format specified by `enwc-mode-line-format'.
 This is initiated during setup, and runs once every second."
-  (setq enwc-display-string (enwc-format-mode-line-string))

[elpa] master 9893d7f 12/13: Updated version to 2.0

2017-04-15 Thread Ian Dunn
branch: master
commit 9893d7f17a2ee7f83587c305c256bd1300995125
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Updated version to 2.0
---
 enwc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/enwc.el b/enwc.el
index b2131d0..088f340 100644
--- a/enwc.el
+++ b/enwc.el
@@ -4,7 +4,7 @@
 
 ;; Author: Ian Dunn <du...@gnu.org>
 ;; Keywords: external, network, wicd, manager, nm
-;; Version: 2.0beta2
+;; Version: 2.0
 ;; Package-Requires: ((emacs "25.1"))
 ;; Homepage: https://savannah.nongnu.org/p/enwc
 



[elpa] master b7529b1 01/13: Fixed wired connection and interface.

2017-04-15 Thread Ian Dunn
branch: master
commit b7529b12826f926da1e9b608a6cad428e12bd57c
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed wired connection and interface.

* enwc-backend.el (enwc--network-ids): Added wired argument
  (enwc-backend): Changed wireless-nw-props to nw-props
  (enwc--wireless-nw-props): Changed to enwc--nw-props

* enwc-nm.el (enwc-nm--ap-to-conn): Replaced with logic from
  enwc-nm-wireless-connect
  (enwc-nm-wireless-connect): Use it
  (enwc-nm--profile-wired-p): New function
  (enwc-nm-get-wired-profiles): Use it and return ids instead of names.
  (enwc-nm-get-wired-nw-props): New function
  (enwc-nm-get-nw-props): Use it

* enwc-wicd.el: Updated to use new backend property.

* enwc.el (enwc-wireless-column-specs, enwc-wired-column-specs): New 
variables
  (enwc-column-specs): Set to value of one or the other.
  (enwc-get-networks): Pass enwc-using-wired.
  (enwc-get-nw-props): Renamed from enwc-get-wireless-nw-props, and call
  enwc--nw-props
  (enwc--update-scan-results): Use it.
  (enwc-scan-internal-wireless, enwc-scan-internal-wired): Removed.
  (enwc-scan-internal): Handle wired or wireless.
  (enwc-display-wired-networks): Removed.
  (enwc-display-networks): Renamed from enwc-display-wireless-networks
  (enwc-redisplay-networks): Call it.
  (enwc-connect-network): No special treatment for wired.
  (enwc-enable-wired, enwc-enable-wireless): New functions.
  (enwc-toggle-wired): Use them.
  (enwc-mode): call enwc-display-networks on revert
---
 enwc-backend.el |  10 ++--
 enwc-nm.el  |  87 +++
 enwc-wicd.el|  12 -
 enwc.el | 140 
 4 files changed, 123 insertions(+), 126 deletions(-)

diff --git a/enwc-backend.el b/enwc-backend.el
index 076907f..a8b8f92 100644
--- a/enwc-backend.el
+++ b/enwc-backend.el
@@ -39,7 +39,7 @@
   ;; Scan interface
   network-ids
   scan
-  wireless-nw-props
+  nw-props
   ;; Connect/disconnect
   connect
   disconnect
@@ -98,11 +98,11 @@ Signals an error if a backend with KEY already exists and 
FORCEP is nil."
 (defun enwc--scan (backend)
   (funcall (enwc-backend-scan backend)))
 
-(defun enwc--network-ids (backend)
-  (funcall (enwc-backend-network-ids backend)))
+(defun enwc--network-ids (backend  wired-p)
+  (funcall (enwc-backend-network-ids backend) wired-p))
 
-(defun enwc--wireless-nw-props (backend id)
-  (funcall (enwc-backend-wireless-nw-props backend) id))
+(defun enwc--nw-props (backend id  wired-p)
+  (funcall (enwc-backend-nw-props backend) id wired-p))
 
 (defun enwc--connect (backend id  wired-p)
   (funcall (enwc-backend-connect backend) id wired-p))
diff --git a/enwc-nm.el b/enwc-nm.el
index b3275e0..391f4ee 100644
--- a/enwc-nm.el
+++ b/enwc-nm.el
@@ -197,24 +197,21 @@
 (defun enwc-nm-get-device-by-name (name)
   (enwc-nm-dbus-default-call-method "GetDeviceByIpIface" :string name))
 
-(defun enwc-nm--ap-to-conn (ap)
-  "Get the connection that corresponds to AP."
-  (let ((ssid (dbus-byte-array-to-string (enwc-nm-get-wireless-network-property
-  ap "Ssid")))
-(conns (enwc-nm-list-connections))
-conn)
-(while (and conns (not conn))
-  (setq conn (pop conns))
+(defun enwc-nm--ap-to-conn (nw)
+  "Get the connection that corresponds to NW."
+  (let ((ap-ssid (dbus-byte-array-to-string
+  (enwc-nm-get-wireless-network-property nw "Ssid")))
+(profile-table (make-hash-table :test #'equal)))
+;; Create a hash table of connections, indexed by ssid
+;; TODO: Store this somewhere else
+(dolist (conn (enwc-nm-list-connections))
   (let ((settings (enwc-nm-get-settings conn)))
-(if settings
-(let ((this-ssid (enwc-nm-get-dbus-dict-entry 
"802-11-wireless/ssid"
-  settings)))
-  (unless (and this-ssid
-   (string-equal (dbus-byte-array-to-string this-ssid)
- ssid))
-(setq conn nil)))
-  (setq conn nil
-conn))
+(map-put profile-table
+ (dbus-byte-array-to-string (enwc-nm-get-dbus-dict-entry
+ "802-11-wireless/ssid"
+ settings))
+ conn)))
+(map-elt profile-table ap-ssid)))
 
 (defun enwc-nm-connection-p (conn)
   "Return non-nil if CONN is a connection object."
@@ -222,6 +219,12 @@
(stringp conn)
(string-match "^/org/freedesktop/NetworkManager/Settings/[0-9]+$" 
conn)))
 
+(defun enwc-nm--profile-wired-p (conn)
+  "Return non-nil if CONN is a wired profile.&q

[elpa] master 0ebaf4e 09/13: Restrict enwc-auto-scan to status variable

2017-04-15 Thread Ian Dunn
branch: master
commit 0ebaf4e24d9292eb71e1c71d2eed0a9a50a11231
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Restrict enwc-auto-scan to status variable

* enwc.el (enwc--auto-scan): Renamed from enwc-auto-scan.
  (enwc-enable-auto-scan-on-startup): New defcustom.
  (enwc--setup-auto-scan): Use it
---
 enwc.el | 30 +-
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/enwc.el b/enwc.el
index e194494..433951f 100644
--- a/enwc.el
+++ b/enwc.el
@@ -83,12 +83,23 @@ The specific information can be set using 
`enwc-mode-line-format'."
   :group 'enwc
   :type 'boolean)
 
-(defcustom enwc-auto-scan nil
-  "Whether or not to have ENWC automatically scan.
+(defcustom enwc-enable-auto-scan-on-startup nil
+  "Whether to enable auto-scan during `enwc-setup'.
+
 If non-nil, then ENWC will automatically scan for
-networks every `enwc-auto-scan-interval' seconds."
+networks every `enwc-auto-scan-interval' seconds.
+
+To enable auto-scan after startup, use `enwc-enable-auto-scan'."
   :group 'enwc
-  :type 'boolean)
+  :group 'boolean)
+
+(defvar enwc--auto-scan nil
+  "Current state of auto-scan.
+
+To enable auto-scan, use `enwc-enable-auto-scan'.
+
+To enable auto-scan at startup, set
+`enwc-enable-auto-scan-on-startup'.")
 
 (defcustom enwc-auto-scan-interval 20
   "The interval between automatic scans.
@@ -408,21 +419,21 @@ This is initiated during setup, and runs once every 
second."
   (unless enwc-scan-timer
 (setq enwc-scan-timer
   (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
-  (setq enwc-auto-scan t)
+  (setq enwc--auto-scan t)
   (message "Auto-scan enabled"))
 
 (defun enwc-disable-auto-scan ()
   "Disable auto scanning."
   (interactive)
   (when enwc-scan-timer (cancel-timer enwc-scan-timer))
-  (setq enwc-auto-scan nil)
+  (setq enwc--auto-scan nil)
   (message "Auto scan disabled"))
 
 (defun enwc-toggle-auto-scan ()
   "Toggles automatic scanning.
 This will use the current value of `enwc-auto-scan-interval'."
   (interactive)
-  (if enwc-auto-scan
+  (if enwc--auto-scan
   (enwc-disable-auto-scan)
 (enwc-enable-auto-scan)))
 
@@ -768,7 +779,7 @@ newly created buffer."
 (enwc-enable-display-mode-line)))
 
 (defun enwc--setup-auto-scan ()
-  (when (and enwc-auto-scan
+  (when (and enwc-enable-auto-scan-on-startup
  (> enwc-auto-scan-interval 0)
  (not enwc-scan-timer))
 (setq enwc-scan-timer
@@ -788,7 +799,8 @@ Load the default backend, forcing it if
 
 If `enwc-display-mode-line' is non-nil, enable the mode line.
 
-If `enwc-auto-scan' is non-nil, start the auto-scan timer."
+If `enwc-enable-auto-scan-on-startup' is non-nil, start the
+auto-scan timer."
   (cond
((and enwc--setup-done enwc-warn-if-already-setup)
 (message "ENWC is already setup."))



[elpa] master a61d78e 03/13: Ask the user about saving network interfaces during `enwc-setup'

2017-04-15 Thread Ian Dunn
branch: master
commit a61d78e3f98f53744aa2c616e1fc71bc6d43c3d0
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Ask the user about saving network interfaces during `enwc-setup'

* enwc.el (enwc-ask-to-save-interfaces): New defcustom.
  (enwc--select-interfaces): Use it, and ask about saving interface changes
  using `customize-save-variable'.
---
 enwc.el | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/enwc.el b/enwc.el
index ce98cd4..f2dd613 100644
--- a/enwc.el
+++ b/enwc.el
@@ -122,6 +122,11 @@ connection.
   :group 'enwc
   :type 'boolean)
 
+(defcustom enwc-ask-to-save-interfaces t
+  "Whether to ask about saving changes to the network interfaces during 
`enwc-setup'."
+  :group 'enwc
+  :type 'boolean)
+
 (defvar enwc-display-string " [0%] "
   "The mode line display string.
 This is altered every second to display the current network strength
@@ -695,11 +700,19 @@ One interface will be used for wireless, and the other 
for wired.
 There is no need to call this function manually; that should be
 left to `enwc-setup'.  Instead, set `enwc-wireless-device' and
 `enwc-wired-device'."
-  (let ((interfaces (funcall enwc-interface-list-function)))
+  (let ((interfaces (funcall enwc-interface-list-function))
+changed)
 (when (string-empty-p enwc-wired-device)
-  (setq enwc-wired-device (completing-read "Wired Interface: " 
interfaces)))
+  (setq enwc-wired-device (completing-read "Wired Interface: " interfaces))
+  (setq changed t))
 (when (string-empty-p enwc-wireless-device)
-  (setq enwc-wireless-device (completing-read "Wireless Interface: " 
interfaces)
+  (setq enwc-wireless-device (completing-read "Wireless Interface: " 
interfaces))
+  (setq changed t))
+(when (and changed
+   enwc-ask-to-save-interfaces
+   (y-or-n-p "Network Interfaces changed.  Save for future 
sessions? "))
+  (customize-save-variable 'enwc-wired-device enwc-wired-device)
+  (customize-save-variable 'enwc-wireless-device enwc-wireless-device
 
 (defvar enwc-mode-map
   (let ((map (make-sparse-keymap)))



[elpa] master b9869fc 04/13: Demoted setup error to message

2017-04-15 Thread Ian Dunn
branch: master
commit b9869fc4051e013a8cd8af0e6f9cb32fadcbd285
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Demoted setup error to message

* enwc.el (enwc-setup): Print a message instead of throwing an error.
---
 enwc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/enwc.el b/enwc.el
index f2dd613..8dc772c 100644
--- a/enwc.el
+++ b/enwc.el
@@ -764,7 +764,7 @@ If `enwc-display-mode-line' is non-nil, enable the mode 
line.
 If `enwc-auto-scan' is non-nil, start the auto-scan timer."
   (cond
((and enwc--setup-done enwc-warn-if-already-setup)
-(user-error "ENWC is already setup."))
+(message "ENWC is already setup."))
(enwc--setup-done t)
(t
 (when (or (string-empty-p enwc-wired-device)



[elpa] master bf628ce 05/13: Remove sort column when switching between wired and wireless

2017-04-15 Thread Ian Dunn
branch: master
commit bf628ce81918535113f10c230d1c0a743ffac227
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Remove sort column when switching between wired and wireless

* enwc.el (enwc-enable-wired):
  (enwc-enable-wireless): Set tabulated-list-sort-key to nil
---
 enwc.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/enwc.el b/enwc.el
index 8dc772c..6a0f6a1 100644
--- a/enwc.el
+++ b/enwc.el
@@ -631,11 +631,13 @@ Moves to the enwc buffer if necessary."
 
 (defun enwc-enable-wired ()
   (setq enwc-using-wired t)
-  (setq enwc-column-specs enwc-wired-column-specs))
+  (setq enwc-column-specs enwc-wired-column-specs)
+  (setq tabulated-list-sort-key nil))
 
 (defun enwc-enable-wireless ()
   (setq enwc-using-wired nil)
-  (setq enwc-column-specs enwc-wireless-column-specs))
+  (setq enwc-column-specs enwc-wireless-column-specs)
+  (setq tabulated-list-sort-key nil))
 
 (defun enwc-toggle-wired ()
   "Toggle the display and mode between wireless and wired.



[elpa] master 8cc5c8f 08/13: Fixed bug in enwc-refresh-widths

2017-04-15 Thread Ian Dunn
branch: master
commit 8cc5c8ffe5427ca280cb74aecf2a9922b00f6170
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed bug in enwc-refresh-widths

* enwc.el (enwc-refresh-widths): Check type of input argument.
---
 enwc.el | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/enwc.el b/enwc.el
index bf424c7..e194494 100644
--- a/enwc.el
+++ b/enwc.el
@@ -497,11 +497,13 @@ ARGS is only for compatibility with the calling function."
 (mapcar
  (lambda (spec)
(pcase-let* (((cl-struct enwc-column-spec detail display conv) spec)
-(new-max (seq-max
-  (map-apply
-   (lambda (id nw)
- (length (funcall conv (alist-get detail 
nw
-   networks)))
+(new-max (if (mapp networks)
+ (seq-max
+  (map-apply
+   (lambda (id nw)
+ (length (funcall conv (alist-get 
detail nw
+   networks))
+   0))
 (min-width (+ (length display) 2)))
  (setf (enwc-column-spec-width spec) (max new-max min-width)))
spec)



[elpa] master updated (c30e4e1 -> 2dad73c)

2017-04-15 Thread Ian Dunn
skolar42 pushed a change to branch master.

  from  c30e4e1   Add new pattern type `de-morgan'
   new  b7529b1   Fixed wired connection and interface.
   new  ed920db   Inform user if enwc-setup has already been called
   new  a61d78e   Ask the user about saving network interfaces during 
`enwc-setup'
   new  b9869fc   Demoted setup error to message
   new  bf628ce   Remove sort column when switching between wired and 
wireless
   new  886420d   Split enwc-setup contents into separate functions
   new  60d9d90   Added tests for interface selection
   new  8cc5c8f   Fixed bug in enwc-refresh-widths
   new  0ebaf4e   Restrict enwc-auto-scan to status variable
   new  17d530d   Add type for enwc-enable-auto-scan-on-startup
   new  7f15c06   Various fixes and improvements
   new  9893d7f   Updated version to 2.0
   new  2dad73c   Merge commit '9893d7f17a2ee7f83587c305c256bd1300995125'


Summary of changes:
 packages/enwc/enwc-backend.el |  10 +-
 packages/enwc/enwc-nm.el  |  87 +--
 packages/enwc/enwc-test.el|  66 +
 packages/enwc/enwc-wicd.el|  12 +-
 packages/enwc/enwc.el | 325 --
 5 files changed, 309 insertions(+), 191 deletions(-)
 create mode 100644 packages/enwc/enwc-test.el



[elpa] master 17d530d 10/13: Add type for enwc-enable-auto-scan-on-startup

2017-04-15 Thread Ian Dunn
branch: master
commit 17d530d6339f5a3d24f62bb8c71813ccaefc7160
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Add type for enwc-enable-auto-scan-on-startup

* enwc.el (enwc-enable-auto-scan-on-startup): Fixed typo in defcustom form.
---
 enwc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/enwc.el b/enwc.el
index 433951f..2ac684e 100644
--- a/enwc.el
+++ b/enwc.el
@@ -91,7 +91,7 @@ networks every `enwc-auto-scan-interval' seconds.
 
 To enable auto-scan after startup, use `enwc-enable-auto-scan'."
   :group 'enwc
-  :group 'boolean)
+  :type 'boolean)
 
 (defvar enwc--auto-scan nil
   "Current state of auto-scan.



[elpa] master 886420d 06/13: Split enwc-setup contents into separate functions

2017-04-15 Thread Ian Dunn
branch: master
commit 886420d7d8502c64e426edeac594757f5d6574f8
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Split enwc-setup contents into separate functions

* enwc.el (enwc--setup-select-interfaces):
  (enwc--setup-load-default-backend):
  (enwc--setup-display-mode-line):
  (enwc--setup-auto-scan): New functions.
  (enwc-setup): Use them.
---
 enwc.el | 41 +++--
 1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/enwc.el b/enwc.el
index 6a0f6a1..bf424c7 100644
--- a/enwc.el
+++ b/enwc.el
@@ -749,6 +749,29 @@ newly created buffer."
   (unless (get-buffer "*ENWC*")
 (enwc-setup-buffer t)))
 
+;; Setup is broken into four functions to ease testing.  This allows developers
+;; to test each one individually without worrying about the side effects of
+;; others
+
+(defun enwc--setup-select-interfaces ()
+  (when (or (string-empty-p enwc-wired-device)
+(string-empty-p enwc-wireless-device))
+(enwc--select-interfaces)))
+
+(defun enwc--setup-load-default-backend ()
+  (enwc-load-default-backend enwc-force-backend-loading))
+
+(defun enwc--setup-display-mode-line ()
+  (when enwc-display-mode-line
+(enwc-enable-display-mode-line)))
+
+(defun enwc--setup-auto-scan ()
+  (when (and enwc-auto-scan
+ (> enwc-auto-scan-interval 0)
+ (not enwc-scan-timer))
+(setq enwc-scan-timer
+  (run-at-time t enwc-auto-scan-interval 'enwc-scan t
+
 (defvar enwc--setup-done nil
   "Non-nil if enwc has already been set up.")
 
@@ -769,20 +792,10 @@ If `enwc-auto-scan' is non-nil, start the auto-scan 
timer."
 (message "ENWC is already setup."))
(enwc--setup-done t)
(t
-(when (or (string-empty-p enwc-wired-device)
-  (string-empty-p enwc-wireless-device))
-  (enwc--select-interfaces))
-
-(enwc-load-default-backend enwc-force-backend-loading)
-
-(when enwc-display-mode-line
-  (enwc-enable-display-mode-line))
-
-(when (and enwc-auto-scan
-   (> enwc-auto-scan-interval 0)
-   (not enwc-scan-timer))
-  (setq enwc-scan-timer
-(run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
+(enwc--setup-select-interfaces)
+(enwc--setup-load-default-backend)
+(enwc--setup-display-mode-line)
+(enwc--setup-auto-scan)
 
 (setq enwc--setup-done t
 



[elpa] master ed920db 02/13: Inform user if enwc-setup has already been called

2017-04-15 Thread Ian Dunn
branch: master
commit ed920dbcd108444121b21edb12104be229750581
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Inform user if enwc-setup has already been called

* enwc.el (enwc-warn-if-already-setup): New defcustom.
  (enwc-setup): Use it, and throw an error if enwc--setup-done is non-nil.
---
 enwc.el | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/enwc.el b/enwc.el
index 6ed962e..ce98cd4 100644
--- a/enwc.el
+++ b/enwc.el
@@ -117,6 +117,11 @@ connection.
   :group 'enwc
   :type 'string)
 
+(defcustom enwc-warn-if-already-setup t
+  "Whether to warn the user if ENWC is already setup when calling 
`enwc-setup'."
+  :group 'enwc
+  :type 'boolean)
+
 (defvar enwc-display-string " [0%] "
   "The mode line display string.
 This is altered every second to display the current network strength
@@ -744,7 +749,11 @@ Load the default backend, forcing it if
 If `enwc-display-mode-line' is non-nil, enable the mode line.
 
 If `enwc-auto-scan' is non-nil, start the auto-scan timer."
-  (unless enwc--setup-done
+  (cond
+   ((and enwc--setup-done enwc-warn-if-already-setup)
+(user-error "ENWC is already setup."))
+   (enwc--setup-done t)
+   (t
 (when (or (string-empty-p enwc-wired-device)
   (string-empty-p enwc-wireless-device))
   (enwc--select-interfaces))
@@ -760,7 +769,7 @@ If `enwc-auto-scan' is non-nil, start the auto-scan timer."
   (setq enwc-scan-timer
 (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
 
-(setq enwc--setup-done t)))
+(setq enwc--setup-done t
 
 ;;;###autoload
 (defun enwc ()



[elpa] scratch/hook-helpers 365d8de 19/19: Add 'packages/hook-helpers/' from commit 'ff95f4944f3d6d1a43aca141cb7fa36a9043704d'

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit 365d8de11cd0347b7963cbcb06f5717e693c1813
Merge: 8e045bc ff95f49
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Add 'packages/hook-helpers/' from commit 
'ff95f4944f3d6d1a43aca141cb7fa36a9043704d'

git-subtree-dir: packages/hook-helpers
git-subtree-mainline: 8e045bc69e918519d716f272a9f3b8e5e4fadf77
git-subtree-split: ff95f4944f3d6d1a43aca141cb7fa36a9043704d
---
 packages/hook-helpers/.gitignore|   2 +
 packages/hook-helpers/.hgignore |   5 +
 packages/hook-helpers/COPYING   | 674 
 packages/hook-helpers/Makefile  |  58 +++
 packages/hook-helpers/hook-helpers-tests.el |  95 
 packages/hook-helpers/hook-helpers.el   | 250 +++
 packages/hook-helpers/hook-helpers.org  | 150 +++
 7 files changed, 1234 insertions(+)

diff --git a/packages/hook-helpers/.gitignore b/packages/hook-helpers/.gitignore
new file mode 100644
index 000..1af0c54
--- /dev/null
+++ b/packages/hook-helpers/.gitignore
@@ -0,0 +1,2 @@
+*.elc
+hook-helpers.html
\ No newline at end of file
diff --git a/packages/hook-helpers/.hgignore b/packages/hook-helpers/.hgignore
new file mode 100644
index 000..c7d4bff
--- /dev/null
+++ b/packages/hook-helpers/.hgignore
@@ -0,0 +1,5 @@
+syntax: glob
+
+# Ignore compiled Emacs lisp files
+*.elc
+hook-helpers-autoloads.el
\ No newline at end of file
diff --git a/packages/hook-helpers/COPYING b/packages/hook-helpers/COPYING
new file mode 100644
index 000..94a9ed0
--- /dev/null
+++ b/packages/hook-helpers/COPYING
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software 

[elpa] scratch/hook-helpers 7970dcf 01/19: Initial commit.

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit 7970dcf1946df27a33cfc5cba14c4211785df214
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Initial commit.
---
 .hgignore   |   5 +
 COPYING | 674 
 Makefile|  41 
 README.org  | 102 +
 hook-helpers.el | 120 ++
 5 files changed, 942 insertions(+)

diff --git a/.hgignore b/.hgignore
new file mode 100644
index 000..c7d4bff
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,5 @@
+syntax: glob
+
+# Ignore compiled Emacs lisp files
+*.elc
+hook-helpers-autoloads.el
\ No newline at end of file
diff --git a/COPYING b/COPYING
new file mode 100644
index 000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+   TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To &qu

[elpa] scratch/hook-helpers ff95f49 18/19: Preparations to push to ELPA

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit ff95f4944f3d6d1a43aca141cb7fa36a9043704d
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Preparations to push to ELPA

Updated copyright on all files.

* hook-helpers.el (package header): Added requirements and bumped version to
  1.1beta1

* hook-helpers.org: Renamed from README.org, updated copyright, and added
  installation section.
---
 .gitignore |  2 +-
 Makefile   |  5 +++--
 hook-helpers-tests.el  |  5 +++--
 hook-helpers.el| 21 +
 README.org => hook-helpers.org | 37 ++---
 5 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/.gitignore b/.gitignore
index ef39635..1af0c54 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
 *.elc
-README.html
\ No newline at end of file
+hook-helpers.html
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 68d4062..9a91f34 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
 # This is part of Hook Helpers
 #
-#  Copyright (C) 2016 Ian Dunn.
+#  Copyright (C) 2016 Ian Dunn
+#  Copyright (C) 2017 Free Software Foundation, Inc.
 #
 #  This program is free software: you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -40,7 +41,7 @@ hook-helpers-autoloads.el:
 clean:
-rm -f *.elc
 
-check:
+check: compile
@$(EMACS) \
-L "." \
--load "ert" \
diff --git a/hook-helpers-tests.el b/hook-helpers-tests.el
index c5758e6..d3b446a 100644
--- a/hook-helpers-tests.el
+++ b/hook-helpers-tests.el
@@ -1,11 +1,12 @@
 ;;; hook-helpers-tests.el --- Tests for hook helpers
 
-;; Copyright (C) 2016,2017 Ian Dunn
+;; Copyright (C) 2016 Ian Dunn
+;; Copyright (C) 2017 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn <du...@gnu.org>
 ;; Keywords: development, hooks
 ;; URL: https://savannah.nongnu.org/projects/hook-helpers-el/
-;; Version: 1.0
+;; Version: 1.1
 
 ;; This program is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
diff --git a/hook-helpers.el b/hook-helpers.el
index dbc7bc0..9772049 100644
--- a/hook-helpers.el
+++ b/hook-helpers.el
@@ -1,13 +1,16 @@
-;;; hook-helpers.el --- Anonymous, modifiable hook functions
+;;; hook-helpers.el --- Anonymous, modifiable hook functions -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2016 Ian Dunn
+;; Copyright (C) 2017 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn <du...@gnu.org>
+;; Maintainer: Ian Dunn <du...@gnu.org>
 ;; Keywords: development, hooks
+;; Package-Requires: ((emacs "25.1"))
 ;; URL: https://savannah.nongnu.org/projects/hook-helpers-el/
-;; Version: 1.1alpha1
+;; Version: 1.1beta1
 ;; Created: 06 May 2016
-;; Modified: 21 May 2016
+;; Modified: 23 Apr 2017
 
 ;; This program is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -27,12 +30,13 @@
 ;; Often times, I see people define a function to be used once in a hook.  If
 ;; they don’t do this, then it will be an anonymous function.  If the anonymous
 ;; function is modified, then the function can’t be removed.  With a function
-;; outside of the ‘add-hook’ call, it looks messy.
+;; outside of the `add-hook' call, it looks messy.
 
-;; The ‘define-hook-helper’ macro is a solution to this.  Think of it as an
-;; anaphoric ‘add-hook’, but one that can be called many times without risking
-;; redundant hook functions.  It gives a cleaner look and feel to Emacs
-;; configuration files.
+;; Hook Helpers are a solution to this.  A "hook helper" is an anonymous,
+;; modifiable function created for the sole purpose of being attached to a 
hook.
+;; This combines the two commonly used methods mentioned above.  The functions
+;; don't exist, so they don't get in the way of `describe-function', but they
+;; can be removed or modified as needed.
 
 ;;; Code:
 
@@ -104,6 +108,7 @@ For each hook HOOK in the original:
   ;; Delete the helper from the hooks
   (cl-delete old-func (symbol-value hook) :test 'equal)))
 
+;;;###autoload
 (defmacro create-hook-helper (id args  docstring  body)
   "Creates a new hook helper ID for the hooks in HOOKS.
 
diff --git a/README.org b/hook-helpers.org
similarity index 82%
rename from README.org
rename to hook-helpers.org
index 2af2a8e..4a72ce1 100644
--- a/README.org
+++ b/hook-helpers.org
@@ -3,7 +3,8 @@
 #+EMAIL: du...@gnu.org
 
 * Copying
-Copyright (C) 2016-2017 Ian Dunn
+Copyright (C) 2016 Ian Dunn
+Copyright (C) 2017 Free Software Foundation, Inc.
 
 #+BEGIN_QUOTE
 This program is free software: you can redistribute it and/or modify
@@ -34,15 +35,38 @@ This combines the two commonly used methods mentioned 
above.  The functions
 don't exist, so they do

[elpa] scratch/hook-helpers 93ae501 12/19: Finished last commit.

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit 93ae501db07671d7ae08b1b7b4700212303549b7
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Finished last commit.
---
 README.org| 95 +++
 hook-helpers-tests.el | 92 +
 2 files changed, 143 insertions(+), 44 deletions(-)

diff --git a/README.org b/README.org
index 9da1813..2af2a8e 100644
--- a/README.org
+++ b/README.org
@@ -3,7 +3,7 @@
 #+EMAIL: du...@gnu.org
 
 * Copying
-Copyright (C) 2016 Ian Dunn
+Copyright (C) 2016-2017 Ian Dunn
 
 #+BEGIN_QUOTE
 This program is free software: you can redistribute it and/or modify
@@ -28,13 +28,13 @@ they don’t do this, then it will be an anonymous function.  
If the anonymous
 function is modified, then the function can’t be removed.  With a function
 outside of the ~add-hook~ call, it looks messy.
 
-The ~define-hook-helper~ macro is a solution to this.  Think of it as an
-anaphoric ~add-hook~, but one that can be called many times without risking
-redundant hook functions.  It gives a cleaner look and feel to Emacs
-configuration files, and could even be used in actual libraries.
+Hook Helpers are a solution to this.  A "hook helper" is an anonymous,
+modifiable function created for the sole purpose of being attached to a hook.
+This combines the two commonly used methods mentioned above.  The functions
+don't exist, so they don't get in the way of ~C-h f~, but they can be removed 
or
+modified as needed.
 
-The purpose of this package is to build upon add-hook and remove-hook.  When 
you
-have something like the following:
+Let's look at an example:
 
 #+BEGIN_SRC emacs-lisp
 (defun my/after-init-hook ()
@@ -64,57 +64,64 @@ Which handles everything for you.
 
 * Usage
 
-Under the hood, ~define-hook-helper~ creates a new function, called
-~hook-helper--HOOK~.
+There are two macros in hook helpers: ~define-hook-helper~ and 
~create-hook-helper~.
+
+The former is a basic case; it creates and adds a helper for a single hook.
+Most hooks have the -hook suffix, so we take advantage of that here for a 
little
+less typing.  In order to add a helper to a non-standard hook, use the 
~:suffix~
+argument:
 
 #+BEGIN_SRC emacs-lisp
-(define-hook-helper after-init ()
-  (set-scroll-bar-mode nil))
+(define-hook-helper my ()
+  :suffix function
+  :append t
+  (message "Hello!"))
 #+END_SRC
 
-The above creates the function ‘hook-helper--after-init’.
+We also introduce the ~:append~ keyword above, which does exactly what it 
sounds
+like.
 
-** "But doesn't that mean I can only use this once per hook?"
+There's one more keyword for ~define-hook-helper~: ~:name~.  This specifies an
+additional name for the new helper.  Without this, its helper ID is just the
+name of the hook; with a ~:name~, its ID is HOOK-NAME/NAME.
 
-I thought about that too, and devised a solution.  ~define-hook-helper~ accepts
-several keywords: name, suffix, and append.  Append does exactly what it says 
on
-the tin: It appends the hook, passing the argument straight to ~add-hook~.
-
-Name tacks a name onto the defined hook function.  For instance, take the
-previous example:
+The work horse of hook helpers is ~create-hook-helper~.  This is the generic 
case,
+capable of adding itself to any number of hooks:
 
 #+BEGIN_SRC emacs-lisp
-(define-hook-helper after-init ()
-  :name env
-  (set-scroll-bar-mode nil))
+(create-hook-helper new-helper ()
+  :hooks (hook-1-hook
+  (hook-2-hook . t)
+  hook-3-function)
+  (message "Look at all that we can do!"))
 #+END_SRC
 
-This creates the function =hook-helper--after-init/env=, thus allowing
-anyone to use ~define-hook-helper~ as many times as they like, without fear
-of name clobbering.
+This creates a new hook helper called "new-helper", and adds it to 
~hook-1-hook~,
+~hook-2-hook~, and ~hook-3-function~, appending to the latter.
 
-Arguments to the new function may also be specified.  Let's say you've got a
-hook like so:
+The ~:hooks~ keyword can have the following form:
 
-#+BEGIN_SRC emacs-lisp
-(define-hook-helper after-make-frame (frame)
-  :suffix "functions"
-  (set-frame-parameter frame 'alpha '(90 50)))
-#+END_SRC
+- A single hook
+- A cons cell (HOOK . APPEND)
+- A list containing a mixture of the above two forms
 
-Also note the ~suffix~ keyword.  This tells ~define-hook-helper~ to add the
-helper to the variable ~after-make-frame-functions~ instead of
-~after-make-frame-hook~.  The arguments tells it to create a function with
-one argument, ~frame~.
+This is called a "hook spec".
 
-** Removing the Function
-To remove the new function from the hook, you can use the function
-~remove-hook-helper~.  It works just as ~define-hook-helper~:
+** Adding and Removing Helpers
+To add or remove helpers, the functions add-hook-helper and remove-hook-helper
+are provided.
 
 #+BEGIN_SRC emacs

[elpa] scratch/hook-helpers 7f1eccf 16/19: Fixed bug in hkhlp-normalize-hook-spec

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit 7f1eccfe4ed4d9e350b272f95b37a2f9da3751e4
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed bug in hkhlp-normalize-hook-spec

* hook-helpers.el (hkhlp-normalize-hook-spec): Correctly handle list 
structure

* hook-helpers-tests.el (hkhlp-normalize-hook-spec-test): Test for single 
list
  form

* Makefile: Add check target
---
 Makefile  | 16 
 hook-helpers-tests.el |  4 +++-
 hook-helpers.el   |  7 ---
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 3ef4668..68d4062 100644
--- a/Makefile
+++ b/Makefile
@@ -39,3 +39,19 @@ hook-helpers-autoloads.el:
 
 clean:
-rm -f *.elc
+
+check:
+   @$(EMACS) \
+   -L "." \
+   --load "ert" \
+   --load "hook-helpers-tests.el" \
+   -f ert-run-tests-batch-and-exit
+
+help:
+   $(info )
+   $(info make all   - Default)
+   $(info make compile   - Compile Emacs Lisp Files)
+   $(info make autoloads - Generate Autoloads)
+   $(info make clean - Remove generated .elc files)
+   $(info make check - Run Tests)
+   @echo ""
diff --git a/hook-helpers-tests.el b/hook-helpers-tests.el
index 9d732fc..c5758e6 100644
--- a/hook-helpers-tests.el
+++ b/hook-helpers-tests.el
@@ -40,7 +40,9 @@
  '((c++-mode-hook) (org-mode-hook . t
   (should (equal (hkhlp-normalize-hook-spec '((c++-mode-hook . t)
   (org-mode-hook . t)))
- '((c++-mode-hook . t) (org-mode-hook . t)
+ '((c++-mode-hook . t) (org-mode-hook . t
+  (should (equal (hkhlp-normalize-hook-spec '((c++-mode-hook . t)))
+ '((c++-mode-hook . t)
 
 (ert-deftest hkhlp-create-hook-helper-test ()
   (let ((test-hook nil))
diff --git a/hook-helpers.el b/hook-helpers.el
index 336cf7c..0923ecf 100644
--- a/hook-helpers.el
+++ b/hook-helpers.el
@@ -42,7 +42,7 @@
 (cl-defstruct hook-helper
   id function hooks source-file)
 
-(defun hkhlp-normalize-hook-spec (hook-spec)
+(defun hkhlp-normalize-hook-spec (hook-spec  recursed)
   "Turns HOOK-SPEC into a list of cons-cells, each one (HOOK . APPEND)
 
 HOOK is the name of the full variable to use
@@ -52,12 +52,13 @@ APPEND is a Boolean"
 ;; HOOK
 (list (cons hook-spec nil)))
((and (consp hook-spec)
+ (symbolp (car hook-spec))
  (booleanp (cdr hook-spec)))
 ;; (HOOK . APPEND)
 (list hook-spec))
-   ((listp hook-spec)
+   ((and (listp hook-spec) (not recursed))
 ;; List of specs
-(apply 'append (mapcar (lambda (spec) (hkhlp-normalize-hook-spec spec)) 
hook-spec)))
+(mapcar (lambda (spec) (car (hkhlp-normalize-hook-spec spec t))) 
hook-spec))
(t
 (warn "Unrecognized hook-spec %s" hook-spec
 



[elpa] branch scratch/hook-helpers created (now 365d8de)

2017-04-23 Thread Ian Dunn
skolar42 pushed a change to branch scratch/hook-helpers.

at  365d8de   Add 'packages/hook-helpers/' from commit 
'ff95f4944f3d6d1a43aca141cb7fa36a9043704d'

This branch includes the following new commits:

   new  7970dcf   Initial commit.
   new  5e4a3a8   Added remove-hook-helper to README.
   new  597fce1   Updated README to include savannah project link.
   new  0386e23   Modified define-hook-helper to more closely match defun.
   new  f1409ec   Updated README to include new usage.
   new  7981caf   Removed docstring argument from `hook-helpers'.
   new  17f7d5d   Restored docstring argument in `define-hook-helper'.
   new  b373c79   Removed define-mode-hook-helpers, since it only moves the 
word "mode" around.
   new  3bb2282   Updated README, removing define-mode-hook-helper.
   new  dff9910   Added `define-hook-function' to allow defining a function 
to be added to multiple hooks.
   new  e253e03   Implemented new design for anonymous helpers
   new  93ae501   Finished last commit.
   new  73d0cb5   Added gitignore file
   new  0fc0b3d   Fixed bug in define-hook-helper
   new  706af98   Clean up describe-hook-helpers
   new  7f1eccf   Fixed bug in hkhlp-normalize-hook-spec
   new  a46803b   Fixed failing tests
   new  ff95f49   Preparations to push to ELPA
   new  365d8de   Add 'packages/hook-helpers/' from commit 
'ff95f4944f3d6d1a43aca141cb7fa36a9043704d'




[elpa] scratch/hook-helpers dff9910 10/19: Added `define-hook-function' to allow defining a function to be added to multiple hooks.

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit dff991047a70cd98cf4329f9f2b92157783bd6cc
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Added `define-hook-function' to allow defining a function to be added to 
multiple hooks.

* hook-helpers.el (define-hook-function): Added.
---
 hook-helpers.el | 34 +++---
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/hook-helpers.el b/hook-helpers.el
index 1e27d4b..c4b781b 100644
--- a/hook-helpers.el
+++ b/hook-helpers.el
@@ -34,10 +34,6 @@
 ;; redundant hook functions.  It gives a cleaner look and feel to Emacs
 ;; configuration files, and could even be used in actual libraries.
 
-;; TODO:
-
-;; - List hook helpers?  Is this useful to anyone?
-
 ;;; Code:
 
 (defconst hook-helper--helper-prefix "hook-helper")
@@ -87,9 +83,21 @@ quoted.  The keywords are:
(function ,func-sym)
,append)
 
+(cl-defmacro remove-hook-helper (hook  name (suffix "hook"))
+  "Remove a hook helper from HOOK-hook.
+
+NAME and SUFFIX are exactly as in ‘define-hook-helper’, and can
+be used to find the exact helper to remove."
+  (let ((func-sym (intern (format "%s--%s%s" hook-helper--helper-prefix 
(symbol-name hook) (if name (concat "/" (symbol-name name)) "")
+`(remove-hook (quote ,(intern (concat (symbol-name hook) "-" suffix))) 
(function ,func-sym
+
 ;;;###autoload
 (defmacro define-hook-function (function args  docstring  body)
-  "Define FUNCTION to be a function, then add it to hooks."
+  "Define FUNCTION to be a function, then add it to hooks.
+
+The hooks to add are specified by the :hooks keyword.  This is a
+simple list of hooks, unquoted, and the new function is added to
+each one."
   (declare (indent defun) (doc-string 3))
   ;; From `define-derived-mode'
   (when (and docstring (not (stringp docstring)))
@@ -101,14 +109,15 @@ quoted.  The keywords are:
   (let ((hooks nil))
 (while (keywordp (car body))
   (pcase (pop body)
-;; Why is hooks a keyword?  It's required.
+;; Hooks is a keyword to allow it to be specified, without requiring 
the
+;; docstring.
 (`:hooks (setq hooks (pop body)))
(_ (pop body
 `(progn
(defun ,function ,args
  ,docstring
  ,@body)
-   (dolist (h ,hooks)
+   (dolist (h (quote ,hooks))
  (add-hook h (function ,function))
 
 ;; Add font lock for both macros.
@@ -116,16 +125,11 @@ quoted.  The keywords are:
  'emacs-lisp-mode
  '(("(\\(define-hook-helper\\)\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
 (1 font-lock-keyword-face)
+(2 font-lock-function-name-face nil t))
+   ("(\\(define-hook-function\\)\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
+(1 font-lock-keyword-face)
 (2 font-lock-function-name-face nil t
 
-(cl-defmacro remove-hook-helper (hook  name (suffix "hook"))
-  "Remove a hook helper from HOOK-hook.
-
-NAME and SUFFIX are exactly as in ‘define-hook-helper’, and can
-be used to find the exact helper to remove."
-  (let ((func-sym (intern (format "%s--%s%s" hook-helper--helper-prefix 
(symbol-name hook) (if name (concat "/" (symbol-name name)) "")
-`(remove-hook (quote ,(intern (concat (symbol-name hook) "-" suffix))) 
(function ,func-sym
-
 (provide 'hook-helpers)
 
 ;;; hook-helpers.el ends here



[elpa] scratch/hook-helpers 597fce1 03/19: Updated README to include savannah project link.

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit 597fce173aa51947fc56831f1c6f690e29e99365
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Updated README to include savannah project link.
---
 README.org | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/README.org b/README.org
index 0e7d7be..935fc25 100644
--- a/README.org
+++ b/README.org
@@ -21,6 +21,8 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #+END_QUOTE
 * Introduction
 
+[[https://savannah.nongnu.org/projects/hook-helpers-el/][Savannah Project]]
+
 Often times, I see people define a function to be used once in a hook.  If
 they don’t do this, then it will be an anonymous function.  If the anonymous
 function is modified, then the function can’t be removed.  With a function
@@ -31,6 +33,30 @@ anaphoric ~add-hook~, but one that can be called many times 
without risking
 redundant hook functions.  It gives a cleaner look and feel to Emacs
 configuration files, and could even be used in actual libraries.
 
+The purpose of this package is to build upon add-hook and remove-hook.  When 
you have something like the following:
+
+#+BEGIN_SRC emacs-lisp
+(defun my/after-init-hook ()
+  (set-scroll-bar-mode nil))
+#+END_SRC
+
+You've got to remember to actually add this to the after-init-hook variable.  
Alternatively, you can use a lambda function:
+
+#+BEGIN_SRC emacs-lisp
+(add-hook 'after-init-hook (lambda () (set-scroll-bar-mode nil)))
+#+END_SRC
+
+But then if you want to modify the function, it's permanently stuck on the 
after-init-hook variable, and you have to deal with it.  It's not a problem for 
after-init-hook, which is used once, but would be a problem for a mode hook, 
like text-mode-hook.
+
+Instead, hook-helpers can do the following:
+
+#+BEGIN_SRC emacs-lisp
+(define-hook-helper after-init
+  (set-scroll-bar-mode nil))
+#+END_SRC
+
+Which handles everything for you.
+
 * Usage
 
 Under the hood, ~define-hook-helper~ creates a new function, called



[elpa] scratch/hook-helpers 0386e23 04/19: Modified define-hook-helper to more closely match defun.

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit 0386e23bd5a14e37db00e8c970d8f4424af0caa7
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Modified define-hook-helper to more closely match defun.

* hook-helpers.el (define-hook-helper):
  (define-mode-hook-helper): Modify to more closely match defun.
---
 hook-helpers.el | 26 --
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/hook-helpers.el b/hook-helpers.el
index a9bc425..7c83545 100644
--- a/hook-helpers.el
+++ b/hook-helpers.el
@@ -37,16 +37,14 @@
 ;; TODO:
 
 ;; - List hook helpers?  Is this useful to anyone?
-;; - Would it be more useful to specify ‘args’ as an argument, identical to the
-;;   way a normal defun is defined?  It's not used that often.
 
 ;;; Code:
 
 (defconst hook-helper--helper-prefix "hook-helper")
 
 ;;;###autoload
-(cl-defmacro define-hook-helper (hook  body  name append args (suffix 
"hook") )
-  "Define a hook helper for the variable HOOK-hook.
+(cl-defmacro define-hook-helper (hook args  docstring  body  
name append (suffix "hook") )
+  "Define a hook helper for the variable HOOK-hook with ARGS as the argument 
list.
 
 This helper consists of all the code in BODY.  HOOK should not be
 quoted.  The keywords are:
@@ -58,17 +56,12 @@ quoted.  The keywords are:
 
 :append  If non-nil, append the hook helper to the hook variable.
 
-:argsShould be a list to pass as the arguments of the new
- function.  ARGS is not a list of variables, but symbols
- that become the names of the arguments.  As such, this
- can be any form allowed as an argument list.
-
 :suffix  Allows a user to specify that the hook variable doesn't
  end with ‘-hook’, but instead with another suffix, such as
  ‘-function’.  SUFFIX should be a string, and defaults to ‘hook’
  if not specified.  Note that SUFFIX is not assumed to start with
  a hyphen."
-  (declare (indent 1))
+  (declare (indent defun) (doc-string 3))
   ;; From package.el - remove the keys from BODY
   (while (keywordp (car body))
 (setq body (cddr body)))
@@ -81,10 +74,8 @@ quoted.  The keywords are:
  (function ,func-sym)
  ,append
 
-(put 'define-hook-helper 'lisp-indent-function 'defun)
-
 ;;;###autoload
-(defmacro define-mode-hook-helper (mode  body)
+(defmacro define-mode-hook-helper (mode args  docstring  body)
   "Define hook helper for MODE.
 
 The suffix \"-mode\" is added to MODE before passing it to
@@ -92,7 +83,7 @@ The suffix \"-mode\" is added to MODE before passing it to
 
 BODY is passed verbatim to ‘define-hook-helper’, so all allowed
 keys for that macro are allowed here."
-  (declare (indent 1))
+  (declare (indent defun) (doc-string 3))
   `(define-hook-helper ,(intern (format "%s-mode" mode)) ,@body))
 
 ;; Add font lock for both macros.
@@ -100,12 +91,10 @@ keys for that macro are allowed here."
  'emacs-lisp-mode
  '(("(\\(define-hook-helper\\)\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
 (1 font-lock-keyword-face)
-(2 font-lock-constant-face nil t))
+(2 font-lock-function-name-face))
("(\\(define-mode-hook-helper\\)\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
 (1 font-lock-keyword-face)
-(2 font-lock-constant-face nil t
-
-(put 'define-mode-hook-helper 'lisp-indent-function 'defun)
+(2 font-lock-function-name-face
 
 (cl-defmacro remove-hook-helper (hook  name (suffix "hook"))
   "Remove a hook helper from HOOK-hook.
@@ -115,6 +104,7 @@ be used to find the exact helper to remove."
   (declare (indent 1))
   (let ((func-sym (intern (format "%s--%s%s" hook-helper--helper-prefix 
(symbol-name hook) (if name (concat "/" (symbol-name name)) "")
 `(remove-hook (quote ,(intern (concat (symbol-name hook) "-" suffix))) 
(function ,func-sym
+
 (provide 'hook-helpers)
 
 ;;; hook-helpers.el ends here



[elpa] scratch/hook-helpers 17f7d5d 07/19: Restored docstring argument in `define-hook-helper'.

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit 17f7d5d92d817641f6341676f6fd319cae2c21cf
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Restored docstring argument in `define-hook-helper'.

* hook-helpers.el (define-hook-helper): Restored docstring argument.
---
 hook-helpers.el | 42 +++---
 1 file changed, 27 insertions(+), 15 deletions(-)

diff --git a/hook-helpers.el b/hook-helpers.el
index 1cbd268..85df095 100644
--- a/hook-helpers.el
+++ b/hook-helpers.el
@@ -43,7 +43,7 @@
 (defconst hook-helper--helper-prefix "hook-helper")
 
 ;;;###autoload
-(cl-defmacro define-hook-helper (hook args  body  name append (suffix 
"hook") )
+(defmacro define-hook-helper (hook args  docstring  body)
   "Define a hook helper for the variable HOOK-hook with ARGS as the argument 
list.
 
 This helper consists of all the code in BODY.  HOOK should not be
@@ -61,18 +61,31 @@ quoted.  The keywords are:
  ‘-function’.  SUFFIX should be a string, and defaults to ‘hook’
  if not specified.  Note that SUFFIX is not assumed to start with
  a hyphen."
-  (declare (indent defun))
-  ;; From package.el - remove the keys from BODY
-  (while (keywordp (car body))
-(setq body (cddr body)))
-  (let ((func-sym (intern (format "%s--%s%s" hook-helper--helper-prefix 
(symbol-name hook) (if name (concat "/" (symbol-name name)) "")
-`(progn
-   (defun ,func-sym ,args
- ,(format "Function to run for %s-%s" (symbol-name hook) suffix)
- ,@body)
-   (add-hook (quote ,(intern (concat (symbol-name hook) "-" suffix)))
- (function ,func-sym)
- ,append
+  (declare (indent defun) (doc-string 3))
+  ;; From `define-derived-mode'
+  (when (and docstring (not (stringp docstring)))
+;; Some trickiness, since what appears to be the docstring may really be
+;; the first element of the body.
+(push docstring body)
+(setq docstring nil))
+  ;; Process the key words
+  (let ((name nil)
+(append nil)
+(suffix "hook"))
+(while (keywordp (car body))
+  (pcase (pop body)
+   (`:name (setq name (pop body)))
+   (`:append (setq append (pop body)))
+   (`:suffix (setq suffix (pop body)))
+   (_ (pop body
+(let ((func-sym (intern (format "%s--%s%s" hook-helper--helper-prefix 
(symbol-name hook) (if name (concat "/" (symbol-name name)) "")
+  `(progn
+ (defun ,func-sym ,args
+   ,(format "Function to run for %s-%s" (symbol-name hook) suffix)
+   ,@body)
+ (add-hook (quote ,(intern (concat (symbol-name hook) "-" suffix)))
+   (function ,func-sym)
+   ,append)
 
 ;;;###autoload
 (defmacro define-mode-hook-helper (mode args  body)
@@ -81,7 +94,7 @@ quoted.  The keywords are:
 The suffix \"-mode\" is added to MODE before passing it to
 ‘define-hook-helper’.
 
-BODY is passed verbatim to ‘define-hook-helper’, so all allowed
+ARGS and BODY are passed verbatim to ‘define-hook-helper’, so all allowed
 keys for that macro are allowed here."
   (declare (indent defun))
   `(define-hook-helper ,(intern (format "%s-mode" mode)) ,args ,@body))
@@ -101,7 +114,6 @@ keys for that macro are allowed here."
 
 NAME and SUFFIX are exactly as in ‘define-hook-helper’, and can
 be used to find the exact helper to remove."
-  (declare (indent 1))
   (let ((func-sym (intern (format "%s--%s%s" hook-helper--helper-prefix 
(symbol-name hook) (if name (concat "/" (symbol-name name)) "")
 `(remove-hook (quote ,(intern (concat (symbol-name hook) "-" suffix))) 
(function ,func-sym
 



[elpa] scratch/hook-helpers 706af98 15/19: Clean up describe-hook-helpers

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit 706af9820d78a99b41d809671b8f594ba22ecbbd
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Clean up describe-hook-helpers

* hook-helpers.el (hkhlp--pp): Use correct indenting and add an extra 
newline.
---
 hook-helpers.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hook-helpers.el b/hook-helpers.el
index f15b15d..336cf7c 100644
--- a/hook-helpers.el
+++ b/hook-helpers.el
@@ -200,7 +200,9 @@ each one."
   (let* ((func (hook-helper-function helper))
  (pp-string (pp-to-string func))
  (id (hook-helper-id helper))
- (indent-first (min (- indent (length (symbol-name id))) 1))
+ (id-name (symbol-name id))
+ (indent (max (+ (length id-name) 1) indent))
+ (indent-first (- indent (length id-name)))
  (pp-lines (split-string pp-string "\n" t)))
 (concat (symbol-name id) (make-string indent-first ?\ ) (car pp-lines) "\n"
 (mapconcat
@@ -209,7 +211,7 @@ each one."
str))
  (cdr pp-lines)
  "\n")
-"\n")))
+"\n\n")))
 
 (defun describe-hook-helpers ()
   "Describe the currently defined hook helpers."



[elpa] scratch/hook-helpers a46803b 17/19: Fixed failing tests

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit a46803b14e777a5407244539e8d8b277acbdc9ff
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Fixed failing tests

* hook-helpers.el: Require 'subr-x
---
 hook-helpers.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hook-helpers.el b/hook-helpers.el
index 0923ecf..dbc7bc0 100644
--- a/hook-helpers.el
+++ b/hook-helpers.el
@@ -36,6 +36,8 @@
 
 ;;; Code:
 
+(require 'subr-x)
+
 (defvar hkhlp--helpers-map nil
   "Map of IDs to helpers.")
 



[elpa] scratch/hook-helpers f1409ec 05/19: Updated README to include new usage.

2017-04-23 Thread Ian Dunn
branch: scratch/hook-helpers
commit f1409ec376bc26d10cb0929dbd9a4d16615f2d79
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

Updated README to include new usage.
---
 README.org | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/README.org b/README.org
index 935fc25..e5c2216 100644
--- a/README.org
+++ b/README.org
@@ -51,7 +51,7 @@ But then if you want to modify the function, it's permanently 
stuck on the after
 Instead, hook-helpers can do the following:
 
 #+BEGIN_SRC emacs-lisp
-(define-hook-helper after-init
+(define-hook-helper after-init ()
   (set-scroll-bar-mode nil))
 #+END_SRC
 
@@ -63,7 +63,7 @@ Under the hood, ~define-hook-helper~ creates a new function, 
called
 ~hook-helper--HOOK~.
 
 #+BEGIN_SRC emacs-lisp
-(define-hook-helper after-init
+(define-hook-helper after-init ()
   (set-scroll-bar-mode nil))
 #+END_SRC
 
@@ -71,14 +71,15 @@ The above creates the function ‘hook-helper--after-init’.
 
 ** "But doesn't that mean I can only use this once per hook?"
 
-I thought about that too, and devised a solution.  ~define-hook-helper~
-accepts several keywords: name, append, and args.  Append does exactly what it
-says on the tin: It appends the hook, passing the argument straight to
-~add-hook~.  Name tacks a name onto the defined hook function.  For instance,
-take the previous example:
+I thought about that too, and devised a solution.  ~define-hook-helper~ accepts
+several keywords: name, suffix, and append.  Append does exactly what it says 
on
+the tin: It appends the hook, passing the argument straight to ~add-hook~.
+
+Name tacks a name onto the defined hook function.  For instance, take the
+previous example:
 
 #+BEGIN_SRC emacs-lisp
-(define-hook-helper after-init
+(define-hook-helper after-init ()
   :name env
   (set-scroll-bar-mode nil))
 #+END_SRC
@@ -87,19 +88,18 @@ This creates the function =hook-helper--after-init/env=, 
thus allowing
 anyone to use ~define-hook-helper~ as many times as they like, without fear
 of name clobbering.
 
-The =args= keyword allows for hook functions that require arguments.  Let's say
-you've got a hook like so:
+Arguments to the new function may also be specified.  Let's say you've got a
+hook like so:
 
 #+BEGIN_SRC emacs-lisp
-(define-hook-helper after-make-frame
-  :args (frame)
+(define-hook-helper after-make-frame (frame)
   :suffix "functions"
   (set-frame-parameter frame 'alpha '(90 50)))
 #+END_SRC
 
 Also note the ~suffix~ keyword.  This tells ~define-hook-helper~ to add the
 helper to the variable ~after-make-frame-functions~ instead of
-~after-make-frame-hook~.  The args keyword tells it to create a function with
+~after-make-frame-hook~.  The arguments tells it to create a function with
 one argument, ~frame~.
 
 ** Mode hooks
@@ -110,7 +110,7 @@ This macro will take the name of a mode (sans the word 
'mode'), and runs
 ~define-hook-helper~.
 
 #+BEGIN_SRC emacs-lisp
-(define-mode-hook-helper text
+(define-mode-hook-helper text ()
   (visual-line-mode 1))
 #+END_SRC
 



  1   2   3   4   5   6   >