11

Sometimes Emacs stops responding to keyboard input. It responds to mouse input though. If I do killall -s SIGUSR2 emacs, the debugger shows this (but remains unresponsive to keyboard):

Debugger entered--entering a function:
* company-pre-command()
  recursive-edit()
  debug(lambda)
* company-pre-command()
  recursive-edit()
  debug(lambda)
* eldoc-pre-command-refresh-echo-area()

This happens every few days and I end up having to kill emacs and restart. How can I fix it?


GNU Emacs 26.1 running emacsclient

Ubuntu 18.04

system-configuration-options: "--build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --program-suffix=26 --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets --with-lcms2 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs26-pCvJBp/emacs26-26.1~1.git07f8f9b=. -fstack-protector-strong -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie'"

system-configuration-features: "XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2"

8
  • 2
    I've encountered this on a handful of occasions (certainly not as frequently as yourself). For me it affected GUI frames only, so emacsclient -nw still takes keyboard input. You may be able to restore GUI functionality by creating a terminal frame and then deleting all other frames, and only then creating a new GUI frame -- I'm not 100% sure of that process though, as my results were inconsistent. If the server was started with emacs --daemon then you may need to delete the (hidden) frame which was created when the daemon started.
    – phils
    Aug 20, 2019 at 0:20
  • 1
    I'm not sure I've seen this with 26.2 come to think of it, so potentially a solution is to upgrade.
    – phils
    Aug 20, 2019 at 0:22
  • 1
    FWIW I compile --with-x-toolkit=lucid and you're using gtk3 so presumably the issue is not specific to any particular X toolkit.
    – phils
    Aug 20, 2019 at 3:53
  • 1
    This smells like a UI bug. If I were to guess, a popup window (window in the UI sense) is being instantiated, but not actually rendered, cutting off your ability to dismiss it. Based on your debug output, it's possibly a company completion popup. Try disabling these popups, If the frequency of your freezes decreases, great, we're on the right track. If not, then I was totally wrong. ;)
    – nega
    Aug 20, 2019 at 15:46
  • 1
    If a freeze happens in a situation where you'd expect a company popup, try to complete a completion by hitting TAB or RET or whatever you've configured. (I assume you've already done this as those are the first keys I'd mash)
    – nega
    Aug 20, 2019 at 15:50

1 Answer 1

12

I had the same issue for years. It actually seems (at least in my case) to be an IBus issue (IBus allows to input multiple languages).

When the keyboard stops responding in Emacs, typing that command in the console solves the problem. It restarts (-r) IBus daemon(-d). I found the solution here.

ibus-daemon --xim -d -r
3
  • I can't recall experiencing this problem myself in more recent times, but I'm taking a note of this so that I can try it if it ever happens to me again. Do you have any insight into whether this an Emacs bug is triggering this?
    – phils
    Nov 15, 2021 at 21:22
  • 1
    Huh, in 2023 in Emacs 29.1 this still happens and this fixed it Aug 24, 2023 at 23:50
  • I second @JosephGarvin. I have never seen this until now, and the ibus command worked. For what it's worth, it seemed to happen to me when I opened a frame using emacsclient. Jan 3 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.