branch: externals/ascii-art-to-unicode
commit a09ace37b3706c665410b7aab92648ec72c5c470
Author: Thien-Thi Nguyen <[email protected]>
Commit: Thien-Thi Nguyen <[email protected]>

    [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’.
---
 ascii-art-to-unicode.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ascii-art-to-unicode.el b/ascii-art-to-unicode.el
index 8078b63..b808c05 100644
--- a/ascii-art-to-unicode.el
+++ b/ascii-art-to-unicode.el
@@ -154,8 +154,13 @@ The char is a string (of length one), with two properties:
   aa2u-components
 
 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