[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 886420d 06/13: Split enwc-setup contents into separate fun
From: |
Ian Dunn |
Subject: |
[elpa] master 886420d 06/13: Split enwc-setup contents into separate functions |
Date: |
Sat, 15 Apr 2017 16:02:44 -0400 (EDT) |
branch: master
commit 886420d7d8502c64e426edeac594757f5d6574f8
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
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 updated (c30e4e1 -> 2dad73c), Ian Dunn, 2017/04/15
- [elpa] master ed920db 02/13: Inform user if enwc-setup has already been called, Ian Dunn, 2017/04/15
- [elpa] master b9869fc 04/13: Demoted setup error to message, Ian Dunn, 2017/04/15
- [elpa] master a61d78e 03/13: Ask the user about saving network interfaces during `enwc-setup', Ian Dunn, 2017/04/15
- [elpa] master bf628ce 05/13: Remove sort column when switching between wired and wireless, Ian Dunn, 2017/04/15
- [elpa] master 0ebaf4e 09/13: Restrict enwc-auto-scan to status variable, Ian Dunn, 2017/04/15
- [elpa] master 17d530d 10/13: Add type for enwc-enable-auto-scan-on-startup, Ian Dunn, 2017/04/15
- [elpa] master 886420d 06/13: Split enwc-setup contents into separate functions,
Ian Dunn <=
- [elpa] master 8cc5c8f 08/13: Fixed bug in enwc-refresh-widths, Ian Dunn, 2017/04/15
- [elpa] master 9893d7f 12/13: Updated version to 2.0, Ian Dunn, 2017/04/15
- [elpa] master b7529b1 01/13: Fixed wired connection and interface., Ian Dunn, 2017/04/15
- [elpa] master 60d9d90 07/13: Added tests for interface selection, Ian Dunn, 2017/04/15
- [elpa] master 7f15c06 11/13: Various fixes and improvements, Ian Dunn, 2017/04/15
- [elpa] master 2dad73c 13/13: Merge commit '9893d7f17a2ee7f83587c305c256bd1300995125', Ian Dunn, 2017/04/15