在 2019年10月28日 +0800 PM7:26,Alan Third <alan@idiocy.org>,写道:
On Sun, Oct 27, 2019 at 11:49:20AM +0000, HaiJun Zhang wrote:
After some debugging work, I think I find the cause.

See the discussion: https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg01096.html

Thanks for working this out. I suspect that we can remove a call to
delete the working text from the C code and just leave it to lisp.

Please try the attached patch.
--
Alan Third 

I tried the patch. It works well for almost all the use cases except the following one:
Press ESC to cancel the input. The working text will not be cleared as before. It will be cleared after inputting another char or pressing ENTER.

I think there are cases like the above when only ’ns-unput-working-text is fired without following ’ns-put-working-text.
 
In my modified ns-unput-working-text, it processes these cases. If the new working text is the same as the old one, then there will be no following ’ns-put-working-text and it clears the working text. Maybe the checking can be done in C?