[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Fixing key bindings on some terminals
From: |
Drew Adams |
Subject: |
RE: Fixing key bindings on some terminals |
Date: |
Mon, 26 May 2014 11:32:41 -0700 (PDT) |
> > See option `normal-erase-is-backspace' for this part, at least.
>
> Thanks, didn't know about that one!
>
> This leaves getting C-? to work has "help-command" with Terminator. Right
> now it behaves like DEL or BACKSPACE, i.e. it deletes forward, since I set
> "normal-erase-is-backspace" to t.
Actually, the *character* `CONTROL ?' (aka ^?, an ASCII control char)
*is* `DEL' (old name `DELETE'). And it is not the key `<backspace>',
the key `<delete>', or the key `C-?'.
That is (for the last part), it might be (and probably is) the case
that when you hold Control and hit `?', you keyboard does not send a
CONTROL ? character but something else. Yes, this is confusing.
If you do `C-h k C-i', that is, hold Control and hit `i', Emacs always
writes `TAB'. But the same does not happen for `C-?' (holding Control
and hitting `?'). Emacs distinguishes the character ^? (aka `DEL')
from the key that is sent from your keyboard when you hold Control and
hit `?'.
So `C-h k C-?' (holding Control and hitting `?') typically tells
you that "C-? is undefined". It does not tell you that `DELL' is
bound to...
If you want `DEL') to invoke `help-command' then bind it to
`help-command':
(global-set-key (kbd "DEL") 'help-command)
(define-key help-map (kbd "DEL") 'help-for-help) ; for `DEL DEL'
Then you can use, for example, `DEL f' for `describe-function' and
`DEL DEL' for `help-for-help'.
You might need to bind `DEL' in additional keymaps also, as some
modes bind `DEL' to other commands. For example, in Emacs Lisp
mode `DEL' is bound to `backward-delete-char-untabify'.
> To sum up, with "normal-erase-is-backspace" on:
> - With Terminator, "describe-key" "C-?" returns "C-d".
> - With XTerm, "describe-key" "C-?" prints "C-?-" and waits for completion.
>
> I tried to dig some more and apparently this has to do with Terminator being
> an ASCII-based terminal, like gnome-terminal. I haven't read enough to know
> for sure, so right now I guess my options are:
Sorry, I know nothing about Terminator.
An ASCII-based terminal should be able to handle `DEL'. But it might
not be able to handle the key that your keyboard sends when you hold
down Control and hit `?'.
If your teminal can handle Control + `?' then you can bind it just as
you did:
(global-set-key (kbd "C-?") 'help-command)
(define-key help-map (kbd "C-?") 'help-for-help)
The fact that this does not work for you tells me that your terminal
does not recognize the key combination Control + `?'. (That would be
the case for any ASCII terminal.)