Avoid signaling errors in emoji.el on empty input
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:45:54 +0000 (15:45 +0200)
* lisp/international/emoji.el (emoji--read-emoji):  Signal
user-error on empty input.  (Bug#68671)

Do not merge to master.

lisp/international/emoji.el

index 8134214bba5df858af052b2accf5d8a4dcda4a18..3bb5c36e4c7a9b1adc74b4f8a90eb148dcc2e8ee 100644 (file)
@@ -680,11 +680,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"))))
 
 (defun emoji--choose-emoji ()
   (pcase-let ((`(,glyph . ,derived) (emoji--read-emoji)))