[Top][All Lists]

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

[elpa] externals/ascii-art-to-unicode 507bf63 29/42: [aa2u slog] Handle

From: Stefan Monnier
Subject: [elpa] externals/ascii-art-to-unicode 507bf63 29/42: [aa2u slog] Handle ‘ucs-names’ that returns a hash table.
Date: Sun, 29 Nov 2020 18:57:08 -0500 (EST)

branch: externals/ascii-art-to-unicode
commit 507bf6301d07231335e09cc8bfc967bc81b6cb6d
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [aa2u slog] Handle ‘ucs-names’ that returns a hash table.
    Reported by Kaushal Modi (bug#28688):
    * packages/ascii-art-to-unicode/ascii-art-to-unicode.el
    (aa2u--lookup): New alias.
    (aa2u-1c): Use ‘aa2u--lookup’.
 ascii-art-to-unicode.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ascii-art-to-unicode.el b/ascii-art-to-unicode.el
index 9223662..c602ff5 100644
--- a/ascii-art-to-unicode.el
+++ b/ascii-art-to-unicode.el
@@ -111,6 +111,14 @@ This specifies the weight of all the lines.")
 ;;; support
+(defalias 'aa2u--lookup
+  ;; Keep some slack: don't ‘eval-when-compile’ here.
+  (if (hash-table-p (ucs-names))
+      ;; Emacs 26 and later
+      #'gethash
+    ;; prior to Emacs 26
+    #'assoc-string))
 (defsubst aa2u--text-p (pos)
   (get-text-property pos 'aa2u-text))
@@ -145,7 +153,7 @@ The char is a string (of length one), with two properties:
 Their values are STRINGIFIER and COMPONENTS, respectively."
-  (let ((s (string (cdr (assoc-string (apply stringifier components)
+  (let ((s (string (cdr (aa2u--lookup (apply stringifier components)
     (propertize s
                 'aa2u-stringifier stringifier

reply via email to

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