help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fixing key bindings on some terminals


From: Kevin Le Gouguec
Subject: Re: Fixing key bindings on some terminals
Date: Mon, 26 May 2014 22:14:55 +0200 (CEST)

Woah, never realized ^? actually was the control character for DEL. Thanks!

Okay so I do not want to bind DEL to "help-command". I'd like "help-command" to 
be bound to "hold control then hit '?'". Right now doing this results in 
"delete-char", and trying to "describe-key" "C-?" gives me the description for 
"C-d".
I tried using 
(global-set-key (kbd "DEL") 'help-command)

But C-? still forward-deleted characters, and "describe-key" still told me I 
typed C-d. So I'm not sure what Terminator sends to Emacs when I hit C-? :/

Of course this is all in Terminator ; XTerm works fine. I.e. these lines...

(global-set-key (kbd "C-?") 'help-command)
(define-key help-map (kbd "C-?") 'help-for-help)

... actually do what I expect them to do.


Not sure what my options are. I don't know how hard it'd be to change 
Terminator to behave like XTerm when it comes to key presses. I guess it's just 
a matter of time before I switch to having one XTerm running Emacs with a bunch 
of terminals inside...


----- Original Message -----
From: "Drew Adams" <drew.adams@oracle.com>
To: "Kevin Le Gouguec" <kevin.le-gouguec@insa-lyon.fr>
Cc: help-gnu-emacs@gnu.org
Sent: Monday, May 26, 2014 8:32:41 PM
Subject: RE: Fixing key bindings on some terminals

> <snip>

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'.

> <snip>

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.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]