emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ian Dunn
Subject: [elpa] master ed920db 02/13: Inform user if enwc-setup has already been called
Date: Sat, 15 Apr 2017 16:02:43 -0400 (EDT)

branch: master
commit ed920dbcd108444121b21edb12104be229750581
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    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 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]