[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 773cef6 24/76: (enwc-backend-symbol-list): New variable.
From: |
Ian Dunn |
Subject: |
[elpa] master 773cef6 24/76: (enwc-backend-symbol-list): New variable. |
Date: |
Thu, 23 Feb 2017 19:42:47 -0500 (EST) |
branch: master
commit 773cef6e1f2af7ace3b90292e180ab7ab79fcead
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>
(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 6417d2c 49/76: Correctly merged old branch., (continued)
- [elpa] master 6417d2c 49/76: Correctly merged old branch., Ian Dunn, 2017/02/23
- [elpa] master eb6b085 11/76: Fixed up copyright information., Ian Dunn, 2017/02/23
- [elpa] master 218aa82 25/76: Fixed prefix of customization group., Ian Dunn, 2017/02/23
- [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 <=
- [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, 2017/02/23
- [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