Subject: bug#4709: 23.1; keyboard-translate not working with emacs daemon

From: Ryo Furue <[email-masked]>
Date: Thu, 15 Oct 2009 08:26:54 -1000 (HST)

Hi Stefan,

Thank you.  You are so kind and patient.

| [. . . keyboard-translate is an obsolete feature . . .]
| 
OK.

Now, I'm totally confused about the so-called "delete" key.
My original problem was that I want to delete the character
before the cursor with C-h .  I thought emacs originally assigns
it to the "delete" key.  But, it seems there's a confusion
in terminology.  You see, I'm so ignorant about those "special"
keys :-) because I don't usually use them except for ESC
(which sits next to "1/!"), TAB, CTRL (which sits next to "A"),
and SHIFT.  I can't type arrow keys, BACKSPACE, ALT, or DELETE,
without searching for them, looking at the keyboard.

| > 1) My delete key doesn't work in the first place.  I don't know
| >   what's wrong but it doesn't do anything on the bash prompt,
| >   for example, and it doesn't delete the character before the cursor
| >   on emacs (A message "End of Buffer" appears in the message line).
| 
| That looks like a problem in itself which you may want to fix.
| What does C-h k <your delete key here> say?

The answer was surprising to me:

  C-d (translated from <delete>) runs the command delete-char, which is
  an interactive built-in function in `C source code'.

  It is bound to <deletechar>, C-d.

I don't know who translates my "delete" to C-d.  But, I've just
found that it does what C-d does.

I've also found that my BACKSPACE key seems to be what emacs
calls DEL:

  DEL (translated from <backspace>) runs the command
  backward-delete-char-untabify, which is an interactive compiled Lisp
  function.

  It is bound to DEL.

(By the way, I obtained these results on "/usr/bin/emacs23 -q", so
 they are not affected by my ~/.emacs .)

So . . . for so many years, I've had the wrong notion that emacs
used the DELETE key (the one below "Insert" and to the left of "End"
on a Dell keyboard which I don't use but happen to find here) to
delete the character before the cursor.  Because of this
misunderstanding, I was confusing you, I suppose.  Sorry.

In any case, my problem stands the same because I don't use
BACKSPACE either (and I'd like to avoid it, if at all
possible).

| The invocation below:
| 
|    (define-key key-translation-map [?\C-h] [?\C-?])
| 
| should do the trick.

Thank you very much for finding that out!  That's much
better than keyboard-translate:

$ emacs --daemon
$ emacsclient -c
 # key-translation is NOT effective.
 # Evaluate (define-key key-translation-map [?\C-h] [?\C-?]).
 # Exit.
$ emacsclient -c
 # key-translation IS effective.
$ emacsclient -c -nw
 # key-translation IS effective.

As you can see, the emacs daemon seems to ignore it
in your ~/.emacs and you still have to manually
evaluate it on an emacsclient.  But, once you've evaluated
it, it seems to stick.  That's a huge improvement.

Since my emacs daemon is sitting on my desktop for many
days, I can live with the current situation.  Maybe
in the future, I hope the emacs daemon recognizes
key-translation-map in ~/.emacs.

Thank you again for your help.

Regards,
Ryo