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

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

[elpa] master 7457d1e 169/348: Add leading zeros to the hex representati


From: Oleh Krehel
Subject: [elpa] master 7457d1e 169/348: Add leading zeros to the hex representation to counsel-unicode-char
Date: Sat, 8 Apr 2017 11:03:49 -0400 (EDT)

branch: master
commit 7457d1e5e70379892f902e80628ab3fc51327dfd
Author: mn1281 <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Add leading zeros to the hex representation to counsel-unicode-char
    
    Unicode hex codes typically have leading 0s, and this change also makes
    searching by hex code easier.
    
    Sort results. With the leading zeros in place, sorting is in correct
    numerical order.
    
    Fixes #662
---
 counsel.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index d091ce8..fecfc7d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -352,13 +352,14 @@ Update the minibuffer with the amount of lines collected 
every
 (defun counsel-unicode-char ()
   "Insert a Unicode character at point."
   (interactive)
-  (let ((minibuffer-allow-text-properties t))
+  (let ((minibuffer-allow-text-properties t)
+        (ivy-sort-max-size (expt 256 6)))
     (setq ivy-completion-beg (point))
     (setq ivy-completion-end (point))
     (ivy-read "Unicode name: "
               (mapcar (lambda (x)
                         (propertize
-                         (format "% -6X% -60s%c" (cdr x) (car x) (cdr x))
+                         (format "%06X % -60s%c" (cdr x) (car x) (cdr x))
                          'result (cdr x)))
                       (ucs-names))
               :action (lambda (char)
@@ -367,7 +368,8 @@ Update the minibuffer with the amount of lines collected 
every
                           (setq ivy-completion-beg (point))
                           (insert-char (get-text-property 0 'result char))
                           (setq ivy-completion-end (point))))
-              :history 'counsel-unicode-char-history)))
+              :history 'counsel-unicode-char-history
+              :sort t)))
 
 ;;* Elisp symbols
 ;;** `counsel-describe-variable'



reply via email to

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