[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22743: 25.0.91: set-quit-char does not work if emacs lacks a control
bug#22743: 25.0.91: set-quit-char does not work if emacs lacks a controlling tty
Sat, 20 Feb 2016 11:40:13 +0200
> From: Duncan Burke <address@hidden>
> Date: Sat, 20 Feb 2016 16:31:54 +1100
> I have heavily customised keybindings on a dvorak layout and this
> rebinding quit away from its default value of C-g.
> I have rebound C-g in keymaps where it is already defined (such as
> minibuffer-local-map and query-replace-map), and have found this to work in
> most cases with one major issue in flyspell-mode.
> flyspell-post-command-hook calls flyspell-check-word-p, which calls sit-for,
> which ultimately calls read_char in keyboard.c.
> quit_char in keyboard.c is by default set to ?\C-g and as a consequence in
> flyspell-mode if C-g is pressed immediately after entering some text a
> quit is
> signalled rather than running the command bound to C-g.
> set-quit-char should be able to change quit_char to my desired value of
> however I run emacs in a graphical window and set-quit-char silently does
> nothing if emacs does not have a controlling tty.
That's documented in the doc string of set-quit-char, so this is by
design. On a TTY, C-g triggers a signal, and Emacs uses a system API
to change the character which does that. But on GUI frames, this is
> I have attached a patch that changes the behaviour of set-quit-char so that
> quit_char is set even if emacs does not have a controlling tty.
I don't think this patch will work reliably, because the parts of code
you changed are not the whole picture. C-g is supported implicitly
and explicitly in many more places. Grep the Lisp sources for C-g to
FWIW, my NSHO is that we should deprecate set-quit-char and remove it
in a future Emacs version. It is no longer reasonable to have a
feature that only works on text terminals.