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

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

[elpa] master dc250bd 008/399: counsel.el (counsel-unicode-char): Don't


From: Oleh Krehel
Subject: [elpa] master dc250bd 008/399: counsel.el (counsel-unicode-char): Don't sort every time
Date: Sat, 20 Jul 2019 14:56:37 -0400 (EDT)

branch: master
commit dc250bd7b577cefadbe89856f2e5e36ae17aa4ed
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-unicode-char): Don't sort every time
    
    Re #1204
---
 counsel.el | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/counsel.el b/counsel.el
index 5c4183e..7cde99c 100644
--- a/counsel.el
+++ b/counsel.el
@@ -4447,19 +4447,23 @@ Candidates comprise `counsel--unicode-names', which 
see.")
   "Insert COUNT copies of a Unicode character at point.
 COUNT defaults to 1."
   (interactive "p")
-  (let ((ivy-sort-max-size (expt 256 6)))
-    (setq ivy-completion-beg (point))
-    (setq ivy-completion-end (point))
-    (ivy-read "Unicode name: " counsel--unicode-table
-              :history 'counsel-unicode-char-history
-              :sort t
-              :action (lambda (name)
-                        (with-ivy-window
-                          (delete-region ivy-completion-beg ivy-completion-end)
-                          (setq ivy-completion-beg (point))
-                          (insert-char (get-text-property 0 'code name) count)
-                          (setq ivy-completion-end (point))))
-              :caller 'counsel-unicode-char)))
+  (setq ivy-completion-beg (point))
+  (setq ivy-completion-end (point))
+  (unless (listp counsel--unicode-table)
+    (setq counsel--unicode-table
+          (sort
+           (all-completions "" counsel--unicode-table)
+           (ivy--sort-function 'counsel-unicode-char))))
+  (ivy-read "Unicode name: " counsel--unicode-table
+            :history 'counsel-unicode-char-history
+            :sort t
+            :action (lambda (name)
+                      (with-ivy-window
+                        (delete-region ivy-completion-beg ivy-completion-end)
+                        (setq ivy-completion-beg (point))
+                        (insert-char (get-text-property 0 'code name) count)
+                        (setq ivy-completion-end (point))))
+            :caller 'counsel-unicode-char))
 
 ;;** `counsel-colors'
 (defun counsel-colors-action-insert-hex (color)



reply via email to

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