Subject: 28.0.50; first key typed ignores current input method (in magit commit buffer)

From: Platon Pronko <[email-masked]>
Date: Thu, 17 Dec 2020 15:52:41 +0300

Minimal init.el for problem reproduction:

(define-minor-mode dvorak-minor-mode "Use english-dvorak input method." :lighter nil
   (if dvorak-minor-mode (activate-input-method "english-dvorak")))
(define-global-minor-mode global-dvorak-mode dvorak-minor-mode dvorak-minor-mode)
(global-dvorak-mode t)

(require 'magit)
(global-set-key (kbd "C-x g") 'magit-status)

I do not know how to make elpa packages load under -Q, unfortunately.

Steps to reproduce:
1. Set up a git repository with a staged change (mkdir test-repo; cd test-repo; git init; touch a; git add a);
2. Launch emacs (GUI) in this directory;
3. Type "C-x g" (or execute magit-status);
4. Type "c c" to open commit buffer;
5. Type "j j" (or any two characters that are different between english and english-dvorak input methods);
6. Observe that inserted characters are different - first one uses the default input method ("j") and second one uses the configured one ("h").

I bisected the problem and found that it was introduced in commit adbb4eacc (on 2020-12-12, by Stefan Monnier).

I'll try looking into the cause now, but will appreciate any pointers (it seems to be touching keyboard.c, and I remember it to be very complex).

In GNU Emacs 28.0.50 (build 14, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.17.4)
  of 2020-12-17 built on the-big-maker
Repository revision: adbb4eacc2a984c0fc0b65ec761368fd9067d6c5
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Arch Linux

Configured using:
  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
  --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
  --with-sound=alsa --with-modules --without-gconf --without-gsettings
  --with-x-toolkit=gtk3 --without-xaw3d'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GLIB NOTIFY INOTIFY ACL
GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2

Important settings:
   value of $LC_TIME: en_SE.UTF-8
   value of $LANG: en_US.UTF-8
   locale-coding-system: utf-8-unix

Major mode: SQL[ANSI]

Minor modes in effect:
   magit-auto-revert-mode: t
   auto-revert-mode: t
   global-git-commit-mode: t
   async-bytecomp-package-mode: t
   shell-dirtrack-mode: t
   global-dvorak-mode: t
   dvorak-minor-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
/home/platon/.emacs.d/elpa/lispy-20201109.1728/elpa hides /home/platon/.emacs.d/elpa/ivy-20201214.2049/elpa
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-ns hides /usr/share/emacs/site-lisp/cider-ns
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-classpath hides /usr/share/emacs/site-lisp/cider-classpath
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-stacktrace hides /usr/share/emacs/site-lisp/cider-stacktrace
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-clojuredocs hides /usr/share/emacs/site-lisp/cider-clojuredocs
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-doc hides /usr/share/emacs/site-lisp/cider-doc
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider hides /usr/share/emacs/site-lisp/cider
/home/platon/.emacs.d/elpa/parseclj-20201012.712/parseclj-ast hides /usr/share/emacs/site-lisp/parseclj-ast
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-connection hides /usr/share/emacs/site-lisp/cider-connection
/home/platon/.emacs.d/elpa/cider-20201210.1748/nrepl-client hides /usr/share/emacs/site-lisp/nrepl-client
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-popup hides /usr/share/emacs/site-lisp/cider-popup
/home/platon/.emacs.d/elpa/parseedn-20200419.1124/parseedn hides /usr/share/emacs/site-lisp/parseedn
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-cheatsheet hides /usr/share/emacs/site-lisp/cider-cheatsheet
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-debug hides /usr/share/emacs/site-lisp/cider-debug
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-completion hides /usr/share/emacs/site-lisp/cider-completion
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-eval hides /usr/share/emacs/site-lisp/cider-eval
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-repl hides /usr/share/emacs/site-lisp/cider-repl
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-inspector hides /usr/share/emacs/site-lisp/cider-inspector
/home/platon/.emacs.d/elpa/parseclj-20201012.712/parseclj hides /usr/share/emacs/site-lisp/parseclj
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-util hides /usr/share/emacs/site-lisp/cider-util
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-eldoc hides /usr/share/emacs/site-lisp/cider-eldoc
/home/platon/.emacs.d/elpa/parseclj-20201012.712/parseclj-parser hides /usr/share/emacs/site-lisp/parseclj-parser
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-browse-ns hides /usr/share/emacs/site-lisp/cider-browse-ns
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-macroexpansion hides /usr/share/emacs/site-lisp/cider-macroexpansion
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-resolve hides /usr/share/emacs/site-lisp/cider-resolve
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-compat hides /usr/share/emacs/site-lisp/cider-compat
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-format hides /usr/share/emacs/site-lisp/cider-format
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-common hides /usr/share/emacs/site-lisp/cider-common
/home/platon/.emacs.d/elpa/a-20201203.1927/a hides /usr/share/emacs/site-lisp/a
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-profile hides /usr/share/emacs/site-lisp/cider-profile
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-selector hides /usr/share/emacs/site-lisp/cider-selector
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-client hides /usr/share/emacs/site-lisp/cider-client
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-scratch hides /usr/share/emacs/site-lisp/cider-scratch
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-repl-history hides /usr/share/emacs/site-lisp/cider-repl-history
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-find hides /usr/share/emacs/site-lisp/cider-find
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-test hides /usr/share/emacs/site-lisp/cider-test
/home/platon/.emacs.d/elpa/cider-20201210.1748/nrepl-dict hides /usr/share/emacs/site-lisp/nrepl-dict
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-overlays hides /usr/share/emacs/site-lisp/cider-overlays
/home/platon/.emacs.d/elpa/protobuf-mode-20200619.1742/protobuf-mode hides /usr/share/emacs/site-lisp/protobuf-mode
/home/platon/.emacs.d/elpa/parseclj-20201012.712/parseclj-lex hides /usr/share/emacs/site-lisp/parseclj-lex
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-mode hides /usr/share/emacs/site-lisp/cider-mode
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-xref hides /usr/share/emacs/site-lisp/cider-xref
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-apropos hides /usr/share/emacs/site-lisp/cider-apropos
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-browse-spec hides /usr/share/emacs/site-lisp/cider-browse-spec
/home/platon/.emacs.d/elpa/cider-20201210.1748/cider-tracing hides /usr/share/emacs/site-lisp/cider-tracing
/home/platon/.emacs.d/elpa/clojure-mode-20201126.1558/clojure-mode hides /usr/share/emacs/site-lisp/clojure-mode
/home/platon/.emacs.d/elpa/epl-20180205.2049/epl hides /usr/share/emacs/site-lisp/epl/epl
/home/platon/.emacs.d/elpa/pkg-info-20150517.1143/pkg-info hides /usr/share/emacs/site-lisp/pkg-info/pkg-info
/home/platon/.emacs.d/elpa/queue-0.2/queue hides /usr/share/emacs/site-lisp/queue/queue
/home/platon/.emacs.d/elpa/sesman-20190909.1754/sesman-browser hides /usr/share/emacs/site-lisp/sesman/sesman-browser
/home/platon/.emacs.d/elpa/sesman-20190909.1754/sesman hides /usr/share/emacs/site-lisp/sesman/sesman
/home/platon/.emacs.d/elpa/spinner-1.7.3/spinner hides /usr/share/emacs/site-lisp/spinner/spinner
/home/platon/.emacs.d/elpa/less-css-mode-20161001.453/less-css-mode hides /home/platon/sync/sources/emacs/lisp/textmodes/less-css-mode

Features:
(shadow sort mail-extr emacsbug sendmail vc-git sql view thingatpt
edmacro kmacro magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff diff-mode magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process magit-mode git-commit transient format-spec magit-git
magit-section magit-utils crm log-edit message rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor cl-extra async-bytecomp advice async shell pcomplete comint
ansi-color ring server dash quail help-mode easy-mmode info package
easymenu browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting cairo move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 142677 11960)
  (symbols 48 14644 1)
  (strings 32 51220 3154)
  (string-bytes 1 1720184)
  (vectors 16 28209)
  (vector-slots 8 323827 18562)
  (floats 8 68 156)
  (intervals 56 377 0)
  (buffers 984 14))