[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c41f462 1/6: Added check for empty dictionary during print
From: |
Ian Dunn |
Subject: |
[elpa] master c41f462 1/6: Added check for empty dictionary during printing |
Date: |
Mon, 19 Feb 2018 14:20:19 -0500 (EST) |
branch: master
commit c41f46288b0afcdd362defd7d9b1a21cd73e42f7
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Added check for empty dictionary during printing
* paced.el (paced-dictionary-empty-p): New defmethod.
(paced-dictionary-length-of-longest-word): Use it.
---
paced.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/paced.el b/paced.el
index 73d9488..984c9be 100644
--- a/paced.el
+++ b/paced.el
@@ -331,6 +331,10 @@ customization interface."
"Return the name of dictionary OBJ."
(oref obj object-name))
+(cl-defmethod paced-dictionary-empty-p ((dict paced-dictionary))
+ "Return non-nil if DICT is empty."
+ (map-empty-p (oref dict usage-hash)))
+
;;; Current Dictionary
(defcustom paced-global-dictionary-enable-alist nil
@@ -1271,11 +1275,15 @@ For how the current dictionary is determined, see
(cl-defmethod paced-dictionary-length-of-longest-word ((dict paced-dictionary))
"Return the length of the longest word in DICT."
- (seq-max
- (map-apply
- (lambda (key _value)
- (length key))
- (oref dict usage-hash))))
+ (cond
+ ;; If DICT is empty, seq-max throws an error.
+ ((paced-dictionary-empty-p dict) 0)
+ (t
+ (seq-max
+ (map-apply
+ (lambda (key _value)
+ (length key))
+ (oref dict usage-hash))))))
(cl-defmethod paced-dictionary-tabulated-list-entries ((dict paced-dictionary))
"Create a value for `tabulated-list-entries' from DICT."
- [elpa] master updated (e65aa3f -> 1143b69), Ian Dunn, 2018/02/19
- [elpa] master a500899 3/6: Added additional excludes to the Org example setup, Ian Dunn, 2018/02/19
- [elpa] master a17be3a 2/6: Documented new change to dictionary printing, Ian Dunn, 2018/02/19
- [elpa] master c41f462 1/6: Added check for empty dictionary during printing,
Ian Dunn <=
- [elpa] master e301a4f 4/6: Regenerated info documentation, Ian Dunn, 2018/02/19
- [elpa] master 1143b69 6/6: Merge commit 'c3683a0a8a611fbd15bb3ec78ccac121843711c9', Ian Dunn, 2018/02/19
- [elpa] master c3683a0 5/6: Fixed bug with non-existent thing at point, Ian Dunn, 2018/02/19