[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a61d78e 03/13: Ask the user about saving network interface
From: |
Ian Dunn |
Subject: |
[elpa] master a61d78e 03/13: Ask the user about saving network interfaces during `enwc-setup' |
Date: |
Sat, 15 Apr 2017 16:02:43 -0400 (EDT) |
branch: master
commit a61d78e3f98f53744aa2c616e1fc71bc6d43c3d0
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
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 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 <=
- [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, 2017/04/15
- [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