[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b5e612f 04/76: * enwc.el (enwc-display-networks, enwc-mayb
From: |
Ian Dunn |
Subject: |
[elpa] master b5e612f 04/76: * enwc.el (enwc-display-networks, enwc-maybe-pretty-entry): Added support for colorizing the current network. |
Date: |
Thu, 23 Feb 2017 19:42:43 -0500 (EST) |
branch: master
commit b5e612fdee6eeb67fd56988839d190708c00e7ef
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>
* enwc.el (enwc-display-networks, enwc-maybe-pretty-entry): Added support
for colorizing the current network.
(enwc-scan): Set up to allow the networks to be updated without the buffer
being displayed.
---
lisp/enwc.el | 73 +++++++++++++++++++++++++++++++++---------------------------
1 file changed, 40 insertions(+), 33 deletions(-)
diff --git a/lisp/enwc.el b/lisp/enwc.el
index f851b62..8436c79 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -237,21 +237,25 @@ whether or not ENWC is in wired mode.")
(defvar enwc-edit-id nil
"This is the network id of the network being edited.")
-(defvar enwc-scan-requested nil)
+(defvar enwc-scan-requested nil
+ "Indicates that a scan has been requested.
+This is used so as to avoid multiple updates of the scan data.")
-(defvar enwc-scan-interactive nil)
+(defvar enwc-scan-interactive nil
+ "Indicates that a scan was interactively requested.
+This is only used internally.")
(make-local-variable 'enwc-edit-id)
;; The Fonts
-(defface enwc-header-face
- '((((class color) (background light))
- (:foreground "Blue"))
- (((class color) (background dark))
- (:foreground "Blue"))
- (t (:background "Blue")))
- "The face for the headers."
- :group 'enwc)
+;; (defface enwc-header-face
+;; '((((class color) (background light))
+;; (:foreground "Blue"))
+;; (((class color) (background dark))
+;; (:foreground "Blue"))
+;; (t (:background "Blue")))
+;; "The face for the headers."
+;; :group 'enwc)
(defface enwc-connected-face
'((((class color) (background dark))
@@ -501,7 +505,8 @@ the scan results."
(setq enwc-essid-width (1+ enwc-essid-width))
(setq enwc-scan-done t)
(if enwc-scan-interactive
- (enwc-display-wireless-networks enwc-last-scan))))
+ (enwc-display-wireless-networks enwc-last-scan))
+ (setq enwc-scan-interactive nil)))
(defun enwc-scan-internal-wired ()
"The scanning routine for a wired connection.
@@ -551,6 +556,12 @@ ENT is the entry, and WIDTH is the column width."
(insert ent)
(insert-char 32 (- width (length ent))))
+(defmacro enwc-maybe-pretty-entry (entry)
+ `(if (eq cur-id (cdr (assoc "id" nw)))
+ (propertize ,entry
+ 'font-lock-face 'enwc-connected-face)
+ ,entry))
+
(defun enwc-display-wireless-networks (networks)
"Displays the networks in the list NETWORKS in the current buffer.
NETWORKS must be in the format returned by
@@ -579,14 +590,15 @@ NETWORKS must be in the format returned by
entry)
(setq entry (list nil
(vector
- (number-to-string (cdr (assoc "id" nw)))
- (concat (number-to-string (cdr (assoc "quality"
nw)))
- "%")
- (cdr (assoc "essid" nw))
- (cdr (assoc "encryption" nw))
- (cdr (assoc "bssid" nw))
- (cdr (assoc "mode" nw))
- (cdr (assoc "channel" nw)))))
+ (enwc-maybe-pretty-entry (number-to-string (cdr
(assoc "id" nw))))
+ (enwc-maybe-pretty-entry
+ (concat (number-to-string (cdr (assoc "quality"
nw)))
+ "%"))
+ (enwc-maybe-pretty-entry (cdr (assoc "essid" nw)))
+ (enwc-maybe-pretty-entry (cdr (assoc "encryption"
nw)))
+ (enwc-maybe-pretty-entry (cdr (assoc "bssid" nw)))
+ (enwc-maybe-pretty-entry (cdr (assoc "mode" nw)))
+ (enwc-maybe-pretty-entry (cdr (assoc "channel"
nw))))))
(setq entries (cons entry entries))))
(setq tabulated-list-entries (nreverse entries))
@@ -605,17 +617,19 @@ functions, and checks whether or not ENWC is using wired."
(enwc-display-wired-networks networks)
(enwc-display-wireless-networks networks)))
-(defun enwc-scan ()
+(defun enwc-scan (&optional nodisp)
"The frontend of the scanning routine. Sets up and moves to
-the ENWC buffer if necessary, and scans and displays the networks."
- (interactive)
- (setq enwc-scan-interactive t)
+the ENWC buffer if necessary, and scans and displays the networks.
+If NODISP is non-nil, then do not display the results in the ENWC
+buffer."
+ (interactive "p")
+ (if (not nodisp)
+ (setq enwc-scan-interactive t))
(if (get-buffer "*ENWC*")
(with-current-buffer "*ENWC*"
(if enwc-using-wired
(progn
(enwc-scan-internal)
- ;;(enwc-display-networks enwc-last-scan)
(goto-char 0)
(forward-line))
(enwc-scan-internal)))))
@@ -959,9 +973,7 @@ and redisplays the settings from the network profile
(define-derived-mode enwc-mode tabulated-list-mode "enwc"
"Mode for working with network connections.
\\{enwc-mode-map}"
- ;;(setq buffer-read-only t)
- (add-hook 'tabulated-list-revert-hook 'enwc-scan nil t)
- )
+ (add-hook 'tabulated-list-revert-hook 'enwc-scan nil t))
(defun enwc-setup-buffer ()
"Sets up the ENWC buffer.
@@ -969,12 +981,7 @@ This first checks to see that it exists,
and if it doesn't, then create it."
(if (not (get-buffer "*ENWC*"))
(with-current-buffer (get-buffer-create "*ENWC*")
- ;;(use-local-map enwc-mode-map)
- ;;(setq major-mode 'enwc-mode
- ;; mode-name "enwc")
- (enwc-mode)
- ;;(setq buffer-read-only t)
- ))
+ (enwc-mode)))
(switch-to-buffer "*ENWC*"))
(provide 'enwc)
- [elpa] master updated (b30addd -> da7e3c6), Ian Dunn, 2017/02/23
- [elpa] master e8b1d77 05/76: * enwc.el (enwc-display-mode-line-timer): Added a variable for the mode line timer., Ian Dunn, 2017/02/23
- [elpa] master 4a3acfc 07/76: * enwc.el (enwc-enable-display-mode-line, enwc-disable-display-mode-line, enwc-toggle-display-mode-line): Broke enable/disable mode line functionality into different functions., Ian Dunn, 2017/02/23
- [elpa] master d091e21 16/76: (enwc-get-profile-sec-info): Removed., Ian Dunn, 2017/02/23
- [elpa] master 20afe01 22/76: (enwc-wicd-save-nw-settings): Updated to work with new interface., Ian Dunn, 2017/02/23
- [elpa] master ca50c21 21/76: (enwc--int-to-byte-list, enwc--byte-list-to-int, enwc--htonl): Added to assist with D-Bus conversion., Ian Dunn, 2017/02/23
- [elpa] master e5c36d3 26/76: (enwc-nm-details-list): Removed., Ian Dunn, 2017/02/23
- [elpa] master 421b0d9 35/76: (enwc-wicd-setup): Renamed to `enwc-wicd-load'., Ian Dunn, 2017/02/23
- [elpa] master 7a3c057 03/76: Added support for toggling the mode line display., Ian Dunn, 2017/02/23
- [elpa] master b5e612f 04/76: * enwc.el (enwc-display-networks, enwc-maybe-pretty-entry): Added support for colorizing the current network.,
Ian Dunn <=
- [elpa] master 89f9418 08/76: enwc.el (enwc-display-wireless-networks): Removed old comment., Ian Dunn, 2017/02/23
- [elpa] master d6aa3ee 02/76: Fixed up enwc-wicd network properties., Ian Dunn, 2017/02/23
- [elpa] master f77237c 12/76: (enwc-format-mode-line-string): Checks to confirm that scan data exists., Ian Dunn, 2017/02/23
- [elpa] master 3662795 23/76: (enwc-cm-scan, enwc-cm-dict-assoc, enwc-cm-get-network-props): Cleaned up code., Ian Dunn, 2017/02/23
- [elpa] master 01075fa 28/76: Fixed up docstrings., Ian Dunn, 2017/02/23
- [elpa] master 11443eb 34/76: enwc-setup.el: Fixed up header and footer., Ian Dunn, 2017/02/23
- [elpa] master 561f9e1 27/76: (enwc-wicd-get-profile-info, enwc-wicd-get-profile-sec-info): Improved docstring., Ian Dunn, 2017/02/23
- [elpa] master cb32122 13/76: (enwc-nm-prop-to-prop, enwc-wicd-prop-to-prop): Convert the properties used internally to the property names used externally., Ian Dunn, 2017/02/23
- [elpa] master d6bee52 32/76: (enwc-wicd.el): Fixed opening header., Ian Dunn, 2017/02/23
- [elpa] master 5088938 40/76: Removed erroneous comment., Ian Dunn, 2017/02/23