emacs-devel
[Top][All Lists]
Advanced

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

Re: Bug report: Key bindings in .emacs don't work as expected when using


From: Stefan Monnier
Subject: Re: Bug report: Key bindings in .emacs don't work as expected when using the emacs daemon
Date: Thu, 22 Oct 2009 15:32:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> 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  <address@hidden>
 
+       * 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




reply via email to

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