[Top][All Lists]

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

[elpa] master 9b7e7f3 1/3: [aa2u] Handle modern ‘ucs-names’ being a has

From: Thien-Thi Nguyen
Subject: [elpa] master 9b7e7f3 1/3: [aa2u] Handle modern ‘ucs-names’ being a hash table.
Date: Tue, 24 Nov 2020 03:43:28 -0500 (EST)

branch: master
commit 9b7e7f3bbd5945ac6c59984886da15108cb0b319
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [aa2u] Handle modern ‘ucs-names’ being a hash table.
    * packages/ascii-art-to-unicode/ascii-art-to-unicode.el (aa2u-1c):
    If the ‘ucs-names’ returns a hash table, use ‘gethash’;
    otherwise, fall back to classic ‘assoc-string’.
 packages/ascii-art-to-unicode/ascii-art-to-unicode.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/packages/ascii-art-to-unicode/ascii-art-to-unicode.el 
index 8078b63..b808c05 100644
--- a/packages/ascii-art-to-unicode/ascii-art-to-unicode.el
+++ b/packages/ascii-art-to-unicode/ascii-art-to-unicode.el
@@ -154,8 +154,13 @@ The char is a string (of length one), with two properties:
 Their values are STRINGIFIER and COMPONENTS, respectively."
-  (let ((s (string (aa2u--lookup-char (apply stringifier components)
-                                      (ucs-names)))))
+  (let* ((store (ucs-names))
+         (key (apply stringifier components))
+         (s (string (if (hash-table-p store)
+                        ;; modern: hash table
+                        (gethash key store)
+                      ;; classic: alist
+                      (cdr (assoc-string key store))))))
     (propertize s
                 'aa2u-stringifier stringifier
                 'aa2u-components components)))

reply via email to

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