[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 59ca546 20/76: (enwc--str-to-sym): Fixed.
From: |
Ian Dunn |
Subject: |
[elpa] master 59ca546 20/76: (enwc--str-to-sym): Fixed. |
Date: |
Thu, 23 Feb 2017 19:42:46 -0500 (EST) |
branch: master
commit 59ca54619590fd7d1c1d12261cc5e153b7d7950e
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>
(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 &optional 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 &optional 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 &optional 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 &optional 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 &rest 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 +837,12 @@ This is mostly useful to view the text of the hidden
entries."
(enwc--make-supplicant-secret private-key-passwd)
(enwc--make-supplicant-file pac-file)
(enwc--make-supplicant-list phase1
- (enwc--make-supplicant-choice peapver "0" "1")
- (enwc--make-supplicant-choice peaplabel "0" "1")
- (enwc--make-supplicant-choice fast-provisioning
"0" "1" "2" "3"))
+ (enwc--make-supplicant-choice peapver "" "0"
"1")
+ (enwc--make-supplicant-choice peaplabel "" "0"
"1")
+ (enwc--make-supplicant-choice fast-provisioning
"" "0" "1" "2" "3"))
(enwc--make-supplicant-list phase2
- (enwc--make-supplicant-choice auth "MD5"
"MSCHAPV2" "OTP" "GTC" "TLS")
- (enwc--make-supplicant-choice autheap "MD5"
"MSCHAPV2" "OTP" "GTC" "TLS")
+ (enwc--make-supplicant-choice auth "" "MD5"
"MSCHAPV2" "OTP" "GTC" "TLS")
+ (enwc--make-supplicant-choice autheap "" "MD5"
"MSCHAPV2" "OTP" "GTC" "TLS")
(enwc--make-supplicant-file ca-cert)
(enwc--make-supplicant-file client-cert)
(enwc--make-supplicant-file private-key)
@@ -891,12 +893,12 @@ For more information, see the documentation for
wpa_supplicant.")
(key-mgmt . ("wpa-eap"))
(pairwise . ("tkip"))
(group . ("tkip"))
- (eap . "peap")
+ (eap . "PEAP")
(identity . req)
(password . req)
(ca-cert . opt)
(phase1 . ((peaplabel . "0")))
- (phase2 . ((auth . "mschapv2"))))))
+ (phase2 . ((auth . "MSCHAPV2"))))))
"The alist of templates for security.
This should be an alist of the form (KEY . ((SUPPLICANT-KEY . INITIAL-INPUT)
...))
Each SUPPLICANT-KEY should be a key from `enwc-supplicant-alist', and
INITIAL-INPUT
@@ -918,6 +920,14 @@ for security information."
(unless wid
(error "Unknown supplicant type %s" (car ent)))
;; Set the initial value for the widget.
+ (when (eq (cadr wid) 'list)
+ (let (act-init)
+ (dolist (arg (widget-get (cdr wid) :args))
+ (push (alist-get (enwc--str-to-sym (downcase (widget-get arg :tag)))
init "")
+ act-init))
+ (setq init (nreverse act-init))
+ (print (car ent))
+ (pp init)))
(cons (cadr wid)
(append (pcase init
(`req `(:required t :value ,(alist-get (car ent) sec-info
"")))
@@ -931,6 +941,7 @@ for security information."
If specified, SEC-INFO is passed to the templates to initialize them."
`(menu-choice
:tag "Security"
+ :indent 2
,@(mapcar
(lambda (tm)
`(list
- [elpa] master c9a94c8 44/76: Added tag 2.0 for changeset 3e2cab525cbc, (continued)
- [elpa] master c9a94c8 44/76: Added tag 2.0 for changeset 3e2cab525cbc, Ian Dunn, 2017/02/23
- [elpa] master c4ac6fc 60/76: Fixed bug in 'enwc-load-default-backend', Ian Dunn, 2017/02/23
- [elpa] master b8697fd 62/76: Added force parameter to `enwc-load-backend'., Ian Dunn, 2017/02/23
- [elpa] master 2ebc214 01/76: Changed timeout on enwc-wicd-get-wireless-network-property., Ian Dunn, 2017/02/23
- [elpa] master 18e4a3a 06/76: Updated copyright notices., Ian Dunn, 2017/02/23
- [elpa] master 0d92006 09/76: (enwc-update-mode-line): Forces the mode line to update when ENWC updates its current signal., Ian Dunn, 2017/02/23
- [elpa] master 742b67a 19/76: Removed several network manager functions., Ian Dunn, 2017/02/23
- [elpa] master 773cef6 24/76: (enwc-backend-symbol-list): New variable., Ian Dunn, 2017/02/23
- [elpa] master b5686da 17/76: (enwc-wicd-get-sec-types): Removed., Ian Dunn, 2017/02/23
- [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., Ian Dunn, 2017/02/23
- [elpa] master 59ca546 20/76: (enwc--str-to-sym): Fixed.,
Ian Dunn <=
- [elpa] master 1722c02 33/76: enwc-cm.el: Fixed up header and footer., Ian Dunn, 2017/02/23
- [elpa] master c8a0397 29/76: Fixed some compilation errors in enwc.el., Ian Dunn, 2017/02/23
- [elpa] master bb68ed5 37/76: Added ignore rules for byte compiled files., Ian Dunn, 2017/02/23
- [elpa] master 6ed7137 43/76: Fix adding to global-mode-string., Ian Dunn, 2017/02/23
- [elpa] master 968e6f0 46/76: Added tag 2.0 for changeset cc2f7aa4ed36, Ian Dunn, 2017/02/23
- [elpa] master 2d5def6 36/76: (*-function): Removed., Ian Dunn, 2017/02/23
- [elpa] master d9cbdb9 39/76: Added some section headers., Ian Dunn, 2017/02/23
- [elpa] master 03a5464 57/76: Changed channel to an integer., Ian Dunn, 2017/02/23
- [elpa] master a6b2b03 61/76: Removed tag 2.0, Ian Dunn, 2017/02/23
- [elpa] master 3491895 14/76: Cleaned up code and consolidated front-end functions., Ian Dunn, 2017/02/23