Avoid signaling errors in emoji.el
authorEshel Yaron <me@eshelyaron.com>
Sat, 27 Jan 2024 13:01:47 +0000 (14:01 +0100)
committerEli Zaretskii <eliz@gnu.org>
Sat, 27 Jan 2024 13:51:39 +0000 (15:51 +0200)
* lisp/international/emoji.el (emoji--read-emoji): Signal
user-error on empty input (bug#68671).

lisp/international/emoji.el

index 3a191c5ecd35acf6bbfccaf2ad071f9d39e43e18..4f3aab5a6be645e9e7345c39153c3bf9953c1659 100644 (file)
@@ -683,11 +683,12 @@ We prefer the earliest unique letter."
                            strings))))
               (complete-with-action action table string pred)))
            nil t)))
-    (when (cl-plusp (length name))
-      (let ((glyph (if emoji-alternate-names
-                       (cadr (split-string name "\t"))
-                     (gethash name emoji--all-bases))))
-        (cons glyph (gethash glyph emoji--derived))))))
+    (if (cl-plusp (length name))
+        (let ((glyph (if emoji-alternate-names
+                         (cadr (split-string name "\t"))
+                       (gethash name emoji--all-bases))))
+          (cons glyph (gethash glyph emoji--derived)))
+      (user-error "You didn't specify an emoji"))))
 
 (defvar-keymap emoji-zoom-map
   "+" #'emoji-zoom-increase