Subject: bug#48042: 26.3; Macros don't work with french-postfix input method

From: Eli Zaretskii <[email-masked]>
Date: Sat, 15 May 2021 13:21:04 +0300

> Date: Sat, 15 May 2021 09:46:02 +0000
> From: Gregory Heytings <[email-masked]>
> cc: Eli Zaretskii <[email-masked]>, [email-masked], [email-masked]
> 
> Here is an updated patch, which uses the '(no-record . EVENT)' approach, 
> and whose changes are therefore limited to quail.el.

Thanks.

To tell you the truth, I'm a bit worried that you inhibit recording
everywhere in quail.el, which seems to contradict my analysis from
back when I made the inhibit--record-char.  How many different input
methods did you try with macros and "C-h l" to make sure this change
indeed causes Emacs to record each produced character just once, and
nothing is either omitted or recorded more than once?  Did you try
some CJK input methods, for example, which offer several alternatives
for each key sequence the user typed?

Other than this main issue, this LGTM, modulo some minor comments
below.

> +(defun quail-add-unread-command-events (key &optional reset)
> +  "Add KEY to `unread-command-events'.

This summary line should mention that the function arranges for the
events not to be recorded, and perhaps also explain in the rest of the
doc string (or in a comment) why is that needed here.

> +When KEY is a character, it is prepended to `unread-command-events' as a
> +cons with a no-record car.
> +When KEY is a vector, its elements are prepended to `unread-command-events'
> +as conses with a no-record car.

The last sentence above is not clear enough, IMO; I originally
interpreted it incorrectly.  I would suggest to reword:

  If KEY is a vector of events, the events are prepended
  to `unread-command-events', after converting each event
  to a cons cell of the form (no-record . EVENT).

> +When RESET is non-nil, the events in `unread-command-events' are first
> +discarded."

I'm not sure we need this as part of the function: it makes the
function more complicated for no good reason.  Why not reset
unread-command-events "by hand" in the one place where that is needed?
Or maybe even explicitly use (no-record . 7) in that one place, and
then you can avoid calling this function, since that one place does
something very different from the rest.

Please also make a single changeset out of this one and the one where
you remove inhibit--record-char; see there for more comments.  I see
no need to separate them into two commits.