I use my .emacs file to set some key bindings:
(global-set-key [M-delete] 'kill-word)
(global-set-key [M-backspace] 'backward-kill-word)
This works as expected if I start emacs from the command line. However, if I use the emacs-daemon, then these keys are not set correctly: In fact, they are switched (which seems to be the standard behaviour if I put nothing into .emacs at all).
A workaround is: Start emacs after the daemon has loaded, open .emacs and execute these two lines by hand.
Steps to Reproduce:
This also happens if I start the emacs daemon after initializing X (so in particular it should have nothing to do with xmodmap).
I used to have this problem before with different keys, namely the buttons XF86Back and XF86Forward on my ThinkPad laptop, which used to be mapped to F19 and F20 some xorg-server-versions before.
Some things never change. Backspace and Delete are a mess since 20 years at least. :-(
I can reproduce the problem as follows:
1. Create ~/.emacs containing only the two mentioned lines.
2. In a X session (using XFCE here), start Emacs with "emacs --daemon".
3. Open an Emacs frame with "emacsclient -c".
4. "C-h k" will show that the keybindings are swapped.
However, I don't really see what we could do about it at the distro level, so I suggest that you report this problem upstream ("M-x report-emacs-bug" or send it to the <firstname.lastname@example.org> mailing list).
Some background reading is here (may be useful for a workaround):
- Function documentation of "normal-erase-is-backspace-mode"
- Emacs manual, section 59.1 "If <DEL> Fails to Delete"
Resolving as UPSTREAM, for the time being.
Please reopen when an upstream fix is available.
An upstream fix seems available:
I tried app-editors/emacs-cvs-23.1.9999-r1, and the bug is gone.
(In reply to comment #3)
> An upstream fix seems available:
I'm a bit worried about the following comment in that patch:
+ ;; Not sure if input-decode-map is really right, but
+ ;; keyboard-translate-table (used below) only works
+ ;; for integer events, and key-translation-table is
+ ;; global (like the global-map, used earlier).
So before including it in a 23.1-r1 ebuild, let's wait for some days if there's any followup on the upstream mailing list.
> I tried app-editors/emacs-cvs-23.1.9999-r1, and the bug is gone.
Thanks for testing it, this is appreciated.
Fixed in emacs-23.1-r1.