Here's what I do when something hangs up. Over the years, I don't recall Emacs being stuck in an unrecoverable state.
Use C-g. Repeatedly if needed. It calls keyboard-quit
.
This should break any stuck loop and give you the ability to enter commands.
Now if geiser or any other process is misbehaving, just kill the buffers that correspond to this process. C-x C-b will give you the list of all buffers. If you don't recognize the one that belongs to geiser, just restart Emacs and open only geiser and see the buffer list again.
Now mark the misbehaving buffers with d. Execute the deletion with x. That's it. You can now restart geiser or whatever else. This approach is completely generic.
By the way, restarting the Ubuntu machine is too drastic.
When nothing works to stop the application with a window, but X still works,
use xkill
utility. I've bound it to Ctrl-Alt-F12
for instance.
Then you just click on a window you don't like and it's gone.
If xkill
doesn't work, switch to a virtual terminal with
Ctrl-Alt-F1
and use htop
to kill the application.