Subject: Re: bug#51118: 28.0.50; arrow keys break agda-input quail package since bd5c7404

From: Gregory Heytings <[email-masked]>
Date: Tue, 12 Oct 2021 12:54:34 +0000

>
> Gregory, could you please look into this?  It needs to be fixed for 
> Emacs 28.
>

Yes.  The problem was that quail-start-translation sometimes changes 
last-command-event and transforms a vector into the symbol of its only 
element.  Patch attached.

From ecd98acd2c46a6b22a3f5e28a50f3bf8cd294813 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <[email-masked]>
Date: Tue, 12 Oct 2021 12:50:21 +0000
Subject: [PATCH] Improve handling of non-character events in input methods

* lisp/international/quail.el (quail-add-unread-command-events):
Handle non-vector event arguments.  Fixes bug#51118.
---
 lisp/international/quail.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 50ff307b73..ee935b11ec 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -1382,6 +1382,8 @@ quail-add-unread-command-events
 If KEY is a vector of events, the events in the vector are prepended
 to `unread-command-events', after converting each event to a cons cell
 of the form (no-record . EVENT).
+If KEY is an event, it is prepended to `unread-command-events' as a cons
+cell of the form (no-record . EVENT).
 If RESET is non-nil, the events in `unread-command-events' are first
 discarded, i.e. in this case KEY will end up being the only key
 in `unread-command-events'."
@@ -1390,7 +1392,7 @@ quail-add-unread-command-events
         (if (characterp key)
             (cons (cons 'no-record key) unread-command-events)
           (append (mapcan (lambda (e) (list (cons 'no-record e)))
-                          (append key nil))
+                          (append (if (vectorp key) key (vector key)) nil))
                   unread-command-events))))
 
 (defun quail-start-translation (key)
-- 
2.33.0