[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ad38333 59/76: Cleaned up enwc-refresh-widths and changed
From: |
Ian Dunn |
Subject: |
[elpa] master ad38333 59/76: Cleaned up enwc-refresh-widths and changed enwc-details-list to enwc-column-specs. |
Date: |
Thu, 23 Feb 2017 19:42:54 -0500 (EST) |
branch: master
commit ad383336c7990e662d371a10c722e32e5fa80489
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Cleaned up enwc-refresh-widths and changed enwc-details-list to
enwc-column-specs.
* enwc.el (enwc-refresh-widths): Cleaned up using pcase-let.
(enwc--get-details): Applied change to enwc-details-list.
(enwc--tabulated-list-printer): Same.
(enwc-display-wireless-networks): Same.
---
lisp/enwc.el | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/lisp/enwc.el b/lisp/enwc.el
index ddd420e..4bc9539 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -37,6 +37,8 @@
;;
;; (require 'enwc)
;; (enwc-load-default-backend)
+;; (enwc-enable-auto-scan)
+;; (enwc-enable-display-mode-line)
;;
;; to your .emacs file (or other init file).
@@ -134,7 +136,7 @@ in `enwc-update-mode-line'.")
(cl-defstruct enwc-column-spec ()
detail display sorter width conv)
-(defconst enwc-details-list
+(defconst enwc-column-specs
(list
(make-enwc-column-spec
:detail 'strength
@@ -172,7 +174,7 @@ This will be an association list of the form:
Each ID is a backend-specific network ID.
Each key in the children association lists corresponds to an entry in
-`enwc-details-list'.")
+`enwc-column-specs'.")
(defvar enwc-access-points nil
"The most recent access point list.")
@@ -263,7 +265,7 @@ Returns `non-nil' if there is one, nil otherwise."
(defun enwc-get-wireless-nw-props (id)
"Get the network properties of the wireless network with id ID.
This will return an associative list with the keys
-corresponding to `enwc-details-list'.
+corresponding to `enwc-column-specs'.
ID is specific to the backend."
(enwc--wireless-nw-props enwc--current-backend id))
@@ -468,21 +470,19 @@ ARGS is only for compatibility with the calling function."
(cl-defun enwc-refresh-widths (&optional (networks enwc-last-scan))
"Refresh the column widths for display."
- (setq enwc-details-list
+ (setq enwc-column-specs
(mapcar
- (lambda (detail)
- (let ((new-max (seq-max
- (map-apply
- ;; TODO: prin1-to-string isn't the formatter. Use
- ;; the actual formatter function as specified by
the
- ;; conv.
- (lambda (id nw)
- (length (prin1-to-string (alist-get
(enwc-column-spec-detail detail) nw))))
- networks)))
- (min-width (1+ (length (enwc-column-spec-display detail)))))
- (setf (enwc-column-spec-width detail) (max new-max min-width))
- detail))
- enwc-details-list)))
+ (lambda (spec)
+ (pcase-let* (((cl-struct enwc-column-spec detail display conv) spec)
+ (new-max (seq-max
+ (map-apply
+ (lambda (id nw)
+ (length (funcall conv (alist-get detail
nw))))
+ networks)))
+ (min-width (+ (length display) 2)))
+ (setf (enwc-column-spec-width spec) (max new-max min-width)))
+ spec)
+ enwc-column-specs)))
(defun enwc-display-wired-networks (networks)
"Display the wired networks specified in the list NETWORKS.
@@ -499,7 +499,7 @@ NETWORKS must be in the form returned from
(mapcar
(lambda (detail)
(alist-get (enwc-column-spec-detail detail) network-entry))
- enwc-details-list))
+ enwc-column-specs))
(defun enwc--tabulated-list-entries ()
(map-apply
@@ -514,7 +514,7 @@ NETWORKS must be in the form returned from
(vconcat
(seq-map-indexed
(lambda (col idx)
- (let* ((detail (nth idx enwc-details-list))
+ (let* ((detail (nth idx enwc-column-specs))
(conv (funcall (enwc-column-spec-conv detail) col)))
(if (equal cur-id id)
(propertize conv 'font-lock-face 'enwc-connected)
@@ -532,7 +532,7 @@ NETWORKS must be in the form returned from
(mapcar
(pcase-lambda ((cl-struct enwc-column-spec display width sorter))
(list display width sorter))
- enwc-details-list)))
+ enwc-column-specs)))
(setq tabulated-list-entries #'enwc--tabulated-list-entries)
(setq tabulated-list-printer #'enwc--tabulated-list-printer)
- [elpa] master ee90297 31/76: (enwc-nm.el): Fixed several docstrings, and file header., (continued)
- [elpa] master ee90297 31/76: (enwc-nm.el): Fixed several docstrings, and file header., Ian Dunn, 2017/02/23
- [elpa] master 4e0d5a2 41/76: Cosmetic changes., Ian Dunn, 2017/02/23
- [elpa] master 8f21449 45/76: Removed tag 2.0, Ian Dunn, 2017/02/23
- [elpa] master ec0539b 42/76: Fixed enwc-setup to be able to be called more than once., Ian Dunn, 2017/02/23
- [elpa] master 5c63470 48/76: Fixed autoloads generation and added hgignore., Ian Dunn, 2017/02/23
- [elpa] master 43c98da 50/76: Changed enwc-last-scan to a hashtable., Ian Dunn, 2017/02/23
- [elpa] master c6585bb 47/76: Added autoloads, Ian Dunn, 2017/02/23
- [elpa] master 48e7aa4 55/76: Updated Makefile, Ian Dunn, 2017/02/23
- [elpa] master 2e07c3a 54/76: Began work on WPA backend. EXPERIMENTAL!, Ian Dunn, 2017/02/23
- [elpa] master ba6061b 51/76: Created more robust backend system., Ian Dunn, 2017/02/23
- [elpa] master ad38333 59/76: Cleaned up enwc-refresh-widths and changed enwc-details-list to enwc-column-specs.,
Ian Dunn <=
- [elpa] master a46fe3c 64/76: Don't switch to the ENWC buffer when processing a scan., Ian Dunn, 2017/02/23
- [elpa] master 33515f8 66/76: Silenced byte-compiler., Ian Dunn, 2017/02/23
- [elpa] master bcb33e6 30/76: (enwc-get-networks): Improved docstring., Ian Dunn, 2017/02/23
- [elpa] master 245a82f 52/76: Moved Wicd and NetworkManager backends to new system., Ian Dunn, 2017/02/23
- [elpa] master 3b1bbc6 69/76: Fixed autoloads target in Makefile, Ian Dunn, 2017/02/23
- [elpa] master 8c17c8c 73/76: Updated hgignore to ignore elc files in top-level directory., Ian Dunn, 2017/02/23
- [elpa] master a3c59cc 74/76: Updated version to 2.0beta1, Ian Dunn, 2017/02/23
- [elpa] master 2e271c6 72/76: Moved lisp files into top-level directory., Ian Dunn, 2017/02/23
- [elpa] master b673e3a 63/76: Added default setup and removed experimental WPA supplicant backend., Ian Dunn, 2017/02/23
- [elpa] master 2c298fc 70/76: Updated copyright and keywords on all files., Ian Dunn, 2017/02/23