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

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

[elpa] externals/ascii-art-to-unicode a09ace3 39/42: [aa2u] Handle mode


From: Stefan Monnier
Subject: [elpa] externals/ascii-art-to-unicode a09ace3 39/42: [aa2u] Handle modern ‘ucs-names’ being a hash table.
Date: Sun, 29 Nov 2020 18:57:10 -0500 (EST)

branch: externals/ascii-art-to-unicode
commit a09ace37b3706c665410b7aab92648ec72c5c470
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’.
---
 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

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