Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 289709 - app-editors/emacs-23.1: Key bindings in .emacs don't work as expected when using app-emacs/emacs-daemon-0.15
Summary: app-editors/emacs-23.1: Key bindings in .emacs don't work as expected when us...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Emacs project
Whiteboard: due 2009-10-28
Keywords: Inclusion
Depends on:
Reported: 2009-10-19 12:47 UTC by Johannes Rauh
Modified: 2009-10-28 19:40 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Rauh 2009-10-19 12:47:27 UTC
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.

Reproducible: Always

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.
Comment 1 Ulrich Müller gentoo-dev 2009-10-19 18:39:13 UTC
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 <> 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"
- <>
Comment 2 Ulrich Müller gentoo-dev 2009-10-21 01:38:54 UTC
Resolving as UPSTREAM, for the time being.

Please reopen when an upstream fix is available.
Comment 3 Johannes Rauh 2009-10-23 09:28:31 UTC
An upstream fix seems available:

I tried app-editors/emacs-cvs-23.1.9999-r1, and the bug is gone.
Comment 4 Ulrich Müller gentoo-dev 2009-10-23 10:36:09 UTC
(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.
Comment 5 Ulrich Müller gentoo-dev 2009-10-28 19:40:11 UTC
Fixed in emacs-23.1-r1.