]> git.eshelyaron.com Git - emacs.git/commitdiff
(x-alternatives-map): New var.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 9 Oct 2007 04:26:29 +0000 (04:26 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 9 Oct 2007 04:26:29 +0000 (04:26 +0000)
(x-setup-function-keys): Use it.

lisp/ChangeLog
lisp/term/x-win.el

index 6b12ee261514d94e48f66832d46a6f11dab903bc..87747db08224cce7ef7ae2677dbc7d2528058995 100644 (file)
@@ -1,5 +1,8 @@
 2007-10-09  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * term/x-win.el (x-alternatives-map): New var.
+       (x-setup-function-keys): Use it.
+
        * help-fns.el (describe-variable): Slightly change the layout of
        meta-info to separate it better from the docstring.
        Standardize insertion of extra empty lines in various circumstances.
index 84cdf7083b4ba547101dfeddb744f141d0cd0bb7..7186e46c31a259dd4263f7161c51f5916e1a1304 100644 (file)
@@ -1177,6 +1177,28 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
 \f
 ;;;; Function keys
 
+(defvar x-alternatives-map
+  (let ((map (make-sparse-keymap)))
+    ;; Map certain keypad keys into ASCII characters that people usually expect.
+    (define-key map [backspace] [127])
+    (define-key map [delete] [127])
+    (define-key map [tab] [?\t])
+    (define-key map [linefeed] [?\n])
+    (define-key map [clear] [?\C-l])
+    (define-key map [return] [?\C-m])
+    (define-key map [escape] [?\e])
+    (define-key map [M-backspace] [?\M-\d])
+    (define-key map [M-delete] [?\M-\d])
+    (define-key map [M-tab] [?\M-\t])
+    (define-key map [M-linefeed] [?\M-\n])
+    (define-key map [M-clear] [?\M-\C-l])
+    (define-key map [M-return] [?\M-\C-m])
+    (define-key map [M-escape] [?\M-\e])
+    (define-key map [iso-lefttab] [backtab])
+    (define-key map [S-iso-lefttab] [backtab]))
+    map)
+  "Keymap of possible alternative meanings for some keys.")
+
 (defun x-setup-function-keys (frame)
   "Set up `function-key-map' on FRAME for the X window system."
   ;; Don't do this twice on the same display, or it would break
@@ -1184,22 +1206,9 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
   (unless (terminal-parameter frame 'x-setup-function-keys)
     ;; Map certain keypad keys into ASCII characters that people usually expect.
     (with-selected-frame frame
-      (define-key local-function-key-map [backspace] [127])
-      (define-key local-function-key-map [delete] [127])
-      (define-key local-function-key-map [tab] [?\t])
-      (define-key local-function-key-map [linefeed] [?\n])
-      (define-key local-function-key-map [clear] [?\C-l])
-      (define-key local-function-key-map [return] [?\C-m])
-      (define-key local-function-key-map [escape] [?\e])
-      (define-key local-function-key-map [M-backspace] [?\M-\d])
-      (define-key local-function-key-map [M-delete] [?\M-\d])
-      (define-key local-function-key-map [M-tab] [?\M-\t])
-      (define-key local-function-key-map [M-linefeed] [?\M-\n])
-      (define-key local-function-key-map [M-clear] [?\M-\C-l])
-      (define-key local-function-key-map [M-return] [?\M-\C-m])
-      (define-key local-function-key-map [M-escape] [?\M-\e])
-      (define-key local-function-key-map [iso-lefttab] [backtab])
-      (define-key local-function-key-map [S-iso-lefttab] [backtab]))
+      (let ((map (copy-keymap x-alternatives-map)))
+        (set-keymap-parent map (keymap-parent local-function-key-map))
+        (set-keymap-parent local-function-key-map map)))
     (set-terminal-parameter frame 'x-setup-function-keys t)))
 
 ;; These tell read-char how to convert