* Bug report: Key bindings in .emacs don't work as expected when using the emacs daemon
@ 2009-10-20 16:13 Johannes Rauh
2009-10-22 19:32 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Rauh @ 2009-10-20 16:13 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]
Good day,
I have the following problem, which I have already posted under http://bugs.gentoo.org/show_bug.cgi?id=289709.
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.
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.
Regards,
Johannes
_________________________________________________________________
Join the Fantasy Football club and win cash prizes here!
http://fantasyfootball.sg.msn.com
[-- Attachment #2: Type: text/html, Size: 1379 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug report: Key bindings in .emacs don't work as expected when using the emacs daemon
2009-10-20 16:13 Bug report: Key bindings in .emacs don't work as expected when using the emacs daemon Johannes Rauh
@ 2009-10-22 19:32 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2009-10-22 19:32 UTC (permalink / raw)
To: Johannes Rauh; +Cc: emacs-devel
> I have the following problem, which I have already posted under http://bugs.gentoo.org/show_bug.cgi?id=289709.
Thanks, I've installed the patch below which should fix your problem.
In the future, please use M-x report-emacs-bug so your bug gets assigned
a number in our tracker.
Stefan
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16479
diff -u -r1.16479 ChangeLog
--- lisp/ChangeLog 22 Oct 2009 16:14:49 -0000 1.16479
+++ lisp/ChangeLog 22 Oct 2009 19:31:30 -0000
@@ -1,5 +1,10 @@
2009-10-22 Stefan Monnier <monnier@iro.umontreal.ca>
+ * simple.el (normal-erase-is-backspace-mode): Use input-decode-map
+ rather than fiddling with global-map bindings, since it should only
+ affect per-terminal settings.
+ See http://bugs.gentoo.org/show_bug.cgi?id=289709.
+
* minibuffer.el (completion-table-with-terminator): Allow to specify
the terminator-regexp.
Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.1018
diff -u -r1.1018 simple.el
--- lisp/simple.el 22 Oct 2009 15:27:20 -0000 1.1018
+++ lisp/simple.el 22 Oct 2009 19:31:30 -0000
@@ -6415,31 +6415,27 @@
(let* ((bindings
`(([M-delete] [M-backspace])
([C-M-delete] [C-M-backspace])
- (,esc-map
- [C-delete] [C-backspace])))
+ ([?\e C-delete] [?\e C-backspace])))
(old-state (lookup-key local-function-key-map [delete])))
(if enabled
(progn
(define-key local-function-key-map [delete] [?\C-d])
(define-key local-function-key-map [kp-delete] [?\C-d])
- (define-key local-function-key-map [backspace] [?\C-?]))
+ (define-key local-function-key-map [backspace] [?\C-?])
+ (dolist (b bindings)
+ ;; 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).
+ (define-key input-decode-map (car b) nil)
+ (define-key input-decode-map (cadr b) nil)))
(define-key local-function-key-map [delete] [?\C-?])
(define-key local-function-key-map [kp-delete] [?\C-?])
- (define-key local-function-key-map [backspace] [?\C-?]))
-
- ;; Maybe swap bindings of C-delete and C-backspace, etc.
- (unless (equal old-state (lookup-key local-function-key-map [delete]))
- (dolist (binding bindings)
- (let ((map global-map))
- (when (keymapp (car binding))
- (setq map (car binding) binding (cdr binding)))
- (let* ((key1 (nth 0 binding))
- (key2 (nth 1 binding))
- (binding1 (lookup-key map key1))
- (binding2 (lookup-key map key2)))
- (define-key map key1 binding2)
- (define-key map key2 binding1)))))))
+ (define-key local-function-key-map [backspace] [?\C-?])
+ (dolist (b bindings)
+ (define-key input-decode-map (car b) (cadr b))
+ (define-key input-decode-map (cadr b) (car b))))))
(t
(if enabled
(progn
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-22 19:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-20 16:13 Bug report: Key bindings in .emacs don't work as expected when using the emacs daemon Johannes Rauh
2009-10-22 19:32 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.