Commit ac09dc1e authored by Karoly Lorentey's avatar Karoly Lorentey
Browse files

Rename function-key-map to local-function-key-map, and global-function-key-map...

Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map.  Same for key-translation-map.

* src/keyboard.h (struct kboard): Rename member 'Vfunction_key_map' to
  'Vlocal_function_key_map', and 'Vkey_translation_map' to
  'Vlocal_key_translation_map'.
  (Vfunction_key_map, Vkey_translation_map): New declarations.

* src/keyboard.c (Vfunction_key_map): New variable.
  (Vglobal_key_translation_map): Rename to Vglobal_key_translation_map.
  (read_key_sequence, init_kboard, syms_of_keyboard, mark_kboards): Update.
* src/keymap.c (Fdescribe_buffer_bindings): Update.
* src/term.c (term_get_fkeys_1): Update.

* lisp/double.el (double-setup): Replace global-key-translation-map with key-translation-map.
* lisp/international/encoded-kb.el (encoded-kbd-setup-display): Ditto.
* lisp/international/iso-transl.el: Ditto.
* lisp/obsolete/iso-acc.el (iso-accents-customize): Ditto.

* lisp/edmacro.el (edmacro-format-keys): Use terminal-local binding of
  local-function-key-map instead of function-key-map.
* lisp/emulation/cua-base.el (cua--pre-command-handler): Ditto.
* lisp/isearch.el (isearch-other-meta-char): Ditto.
* lisp/subr.el (read-quoted-char): Ditto.
* lisp/term/vt200.el: Ditto.
* lisp/term/vt201.el: Ditto.
* lisp/term/vt220.el: Ditto.
* lisp/term/vt240.el: Ditto.
* lisp/term/vt300.el: Ditto.
* lisp/term/vt320.el: Ditto.
* lisp/term/vt400.el: Ditto.
* lisp/term/vt420.el: Ditto.

* lisp/simple.el (normal-erase-is-backspace-mode): Add todo note.
* lisp/xt-mouse.el: Ditto.

* lisp/term/AT386.el: Adapt for renaming of function-key-map to local-function-key-map.
* lisp/term/internal.el: Ditto.
* lisp/term/iris-ansi.el: Ditto.
* lisp/term/lk201.el: Ditto.
* lisp/term/mac-win.el: Ditto.
* lisp/term/news.el: Ditto.
* lisp/term/rxvt.el: Ditto.
* lisp/term/sun.el: Ditto.
* lisp/term/tvi970.el: Ditto.
* lisp/term/wyse50.el: Ditto.
* lisp/term/x-win.el (x-setup-function-keys): Ditto.
* lisp/term/xterm.el: Ditto.

git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-386
parent a9d63618
......@@ -144,18 +144,18 @@ but not `C-u X' or `ESC X' since the X is not the prefix key."
(if enable-flag
(progn
;; Set up key-translation-map as indicated by `double-map'.
;; XXX I don't think global-key-translation-map should be made local here. -- Lorentey
(kill-local-variable 'global-key-translation-map)
(make-local-variable 'global-key-translation-map)
(setq global-key-translation-map (if (keymapp global-key-translation-map)
(copy-keymap global-key-translation-map)
;; XXX I don't think key-translation-map should be made local here. -- Lorentey
(kill-local-variable 'key-translation-map)
(make-local-variable 'key-translation-map)
(setq key-translation-map (if (keymapp key-translation-map)
(copy-keymap key-translation-map)
(make-sparse-keymap)))
(mapcar (function (lambda (entry)
(define-key global-key-translation-map
(define-key key-translation-map
(vector (nth 0 entry))
'double-translate-key)))
(append double-map '((magic-start) (magic-end)))))
(kill-local-variable 'global-key-translation-map)))
(kill-local-variable 'key-translation-map)))
;;; Mode
......
......@@ -443,7 +443,8 @@ doubt, use whitespace."
(rest-mac (vconcat macro [end-macro]))
(res "")
(len 0)
(one-line (eq verbose 1)))
(one-line (eq verbose 1))
(fkm (terminal-local-value 'local-function-key-map nil)))
(if one-line (setq verbose nil))
(when (stringp macro)
(loop for i below (length macro) do
......@@ -488,9 +489,9 @@ doubt, use whitespace."
(fkey nil) tlen tkey
(bind (or (loop for map in maps for b = (lookup-key map key)
thereis (and (not (integerp b)) b))
(and (setq fkey (lookup-key function-key-map rest-mac))
(and (setq fkey (lookup-key fkm rest-mac))
(setq tlen fkey tkey (edmacro-subseq rest-mac 0 tlen)
fkey (lookup-key function-key-map tkey))
fkey (lookup-key fkm tkey))
(loop for map in maps
for b = (lookup-key map fkey)
when (and (not (integerp b)) b)
......
......@@ -1083,9 +1083,9 @@ If ARG is the atom `-', scroll upward by nearly full screen."
(memq 'shift (event-modifiers
(aref (this-single-command-keys) 0)))
;; See if raw escape sequence maps to a shifted event, e.g. S-up or C-S-home.
(and (boundp 'function-key-map)
function-key-map
(let ((ev (lookup-key function-key-map
(and (boundp 'local-function-key-map)
(terminal-local-value 'local-function-key-map nil)
(let ((ev (lookup-key (terminal-local-value 'local-function-key-map nil)
(this-single-command-raw-keys))))
(and (vector ev)
(symbolp (setq ev (aref ev 0)))
......
......@@ -260,9 +260,9 @@ DISPLAY may be a display id, a frame, or nil for the selected frame's display."
(when frame
(with-selected-frame frame
;; Remove any previous encoded-kb keymap from key-translation-map.
(let ((m (terminal-local-value 'key-translation-map frame)))
(let ((m (terminal-local-value 'local-key-translation-map frame)))
(if (equal (keymap-prompt m) "encoded-kb")
(set-terminal-local-value 'key-translation-map frame (keymap-parent m))
(set-terminal-local-value 'local-key-translation-map frame (keymap-parent m))
(while (keymap-parent m)
(if (equal (keymap-prompt (keymap-parent m)) "encoded-kb")
(set-keymap-parent m (keymap-parent (keymap-parent m))))
......@@ -274,8 +274,8 @@ DISPLAY may be a display id, a frame, or nil for the selected frame's display."
(keymap (make-sparse-keymap "encoded-kb"))
(cim (current-input-mode))
result)
(set-keymap-parent keymap (terminal-local-value 'key-translation-map frame))
(set-terminal-local-value 'key-translation-map frame keymap)
(set-keymap-parent keymap (terminal-local-value 'local-key-translation-map frame))
(set-terminal-local-value 'local-key-translation-map frame keymap)
(or (terminal-parameter nil 'encoded-kbd-saved-input-mode)
(set-terminal-parameter nil 'encoded-kbd-saved-input-mode cim))
(setq result (and coding (encoded-kbd-setup-keymap keymap coding)))
......
......@@ -41,8 +41,8 @@
;;; Code:
;;; Provide some binding for startup:
;;;###autoload (or global-key-translation-map (setq global-key-translation-map (make-sparse-keymap)))
;;;###autoload (define-key global-key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
;;;###autoload (or key-translation-map (setq key-translation-map (make-sparse-keymap)))
;;;###autoload (define-key key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
;;;###autoload (autoload 'iso-transl-ctl-x-8-map "iso-transl" "Keymap for C-x 8 prefix." t 'keymap)
(defvar iso-transl-dead-key-alist
......@@ -245,9 +245,9 @@ sequence VECTOR. (VECTOR is normally one character long.)")
(or iso-transl-ctl-x-8-map
(fset 'iso-transl-ctl-x-8-map
(setq iso-transl-ctl-x-8-map (make-sparse-keymap))))
(or global-key-translation-map
(setq global-key-translation-map (make-sparse-keymap)))
(define-key global-key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
(or key-translation-map
(setq key-translation-map (make-sparse-keymap)))
(define-key key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
;; For each entry in the alist, we'll make up to three ways to generate
;; the character in question: the prefix `C-x 8'; the ALT modifier on
......@@ -263,7 +263,7 @@ sequence VECTOR. (VECTOR is normally one character long.)")
(vec (vconcat (car (car alist))))
(tail iso-transl-dead-key-alist))
(aset vec 0 (logior (aref vec 0) ?\A-\^@))
(define-key global-key-translation-map vec translated-vec)
(define-key key-translation-map vec translated-vec)
(define-key isearch-mode-map (vector (aref vec 0)) nil)
(while tail
(if (eq (car (car tail)) inchar)
......@@ -271,7 +271,7 @@ sequence VECTOR. (VECTOR is normally one character long.)")
(deadkey (cdr (car tail))))
(aset deadvec 0 deadkey)
(define-key isearch-mode-map (vector deadkey) nil)
(define-key global-key-translation-map deadvec translated-vec)))
(define-key key-translation-map deadvec translated-vec)))
(setq tail (cdr tail)))))
(setq alist (cdr alist))))
......
......@@ -1648,9 +1648,10 @@ Isearch mode."
(this-command-keys)))
(main-event (aref key 0))
(keylist (listify-key-sequence key))
(fkm (terminal-local-value 'local-function-key-map nil))
scroll-command isearch-point)
(cond ((and (= (length key) 1)
(let ((lookup (lookup-key function-key-map key)))
(let ((lookup (lookup-key fkm key)))
(not (or (null lookup) (integerp lookup)
(keymapp lookup)))))
;; Handle a function key that translates into something else.
......@@ -1664,7 +1665,7 @@ Isearch mode."
(isearch-done)
(apply 'isearch-unread keylist))
(setq keylist
(listify-key-sequence (lookup-key function-key-map key)))
(listify-key-sequence (lookup-key fkm key)))
(while keylist
(setq key (car keylist))
;; If KEY is a printing char, we handle it here
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -395,15 +395,15 @@ It selects the customization based on the specifications in the
(setq table (cdr table)))
(setq iso-language language
iso-accents-list table)
(if global-key-translation-map
(if key-translation-map
(substitute-key-definition
'iso-accents-accent-key nil global-key-translation-map)
(setq global-key-translation-map (make-sparse-keymap)))
'iso-accents-accent-key nil key-translation-map)
(setq key-translation-map (make-sparse-keymap)))
;; Set up translations for all the characters that are used as
;; accent prefixes in this language.
(setq tail iso-accents-list)
(while tail
(define-key global-key-translation-map (vector (car (car tail)))
(define-key key-translation-map (vector (car (car tail)))
'iso-accents-accent-key)
(setq tail (cdr tail))))))
......
......@@ -5269,6 +5269,7 @@ See also `normal-erase-is-backspace'."
(if normal-erase-is-backspace
(progn
;; XXX Perhaps this mode should be terminal-local, not global -- lorentey
(define-key function-key-map [delete] [?\C-d])
(define-key function-key-map [kp-delete] [?\C-d])
(define-key function-key-map [backspace] [?\C-?]))
......
......@@ -1172,7 +1172,8 @@ any other non-digit terminates the character code and is then used as input."))
;; or C-q C-x might not return immediately since ESC or C-x might be
;; bound to some prefix in function-key-map or key-translation-map.
(setq translated char)
(let ((translation (lookup-key function-key-map (vector char))))
(let ((translation (lookup-key (terminal-local-value 'local-function-key-map nil)
(vector char))))
(if (arrayp translation)
(setq translated (aref translation 0))))
(cond ((null translated))
......
......@@ -31,7 +31,7 @@
(if (boundp 'AT386-keypad-map)
nil
;; The terminal initialization should already have set up some keys
(setq AT386-keypad-map (lookup-key (terminal-local-value 'function-key-map nil) "\e["))
(setq AT386-keypad-map (lookup-key (terminal-local-value 'local-function-key-map nil) "\e["))
(if (not (keymapp AT386-keypad-map))
(error "What? Your AT386 termcap/terminfo has no keycaps in it"))
......@@ -54,7 +54,7 @@
(define-key AT386-keypad-map "T" [kp-add])
;; Arrange for the ALT key to be equivalent to ESC
(define-key (terminal-local-value 'function-key-map nil) "\eN" [27]) ; ALT map
(define-key (terminal-local-value 'local-function-key-map nil) "\eN" [27]) ; ALT map
)
;;; arch-tag: abec1b03-582f-49f8-b8cb-e2fd52ea4bd7
......
......@@ -28,7 +28,7 @@
;; ---------------------------------------------------------------------------
;; keyboard setup -- that's simple!
(set-input-mode nil nil 0)
(let (m (terminal-local-value 'function-key-map nil))
(let (m (terminal-local-value 'local-function-key-map nil))
(define-key m [backspace] "\177") ; Normal behaviour for BS
(define-key m [delete] "\C-d") ; ... and Delete
(define-key m [tab] [?\t])
......
......@@ -333,8 +333,8 @@
;; This way we don't override terminfo-derived settings or settings
;; made in the .emacs file.
(let ((m (copy-keymap iris-function-map)))
(set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil)))
(set-keymap-parent (terminal-local-value 'function-key-map nil) m))
(set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
(set-keymap-parent (terminal-local-value 'local-function-key-map nil) m))
;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
;;; iris-ansi.el ends here
......@@ -79,8 +79,8 @@
;; This way we don't override terminfo-derived settings or settings
;; made in the .emacs file.
(let ((m (copy-keymap lk201-function-map)))
(set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil)))
(set-keymap-parent (terminal-local-value 'function-key-map nil) m))
(set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
(set-keymap-parent (terminal-local-value 'local-function-key-map nil) m))
;;; arch-tag: 7ffb4444-6a23-43e1-b457-43cf4f673c0d
;;; lk201.el ends here
......@@ -1059,7 +1059,7 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
;; Map certain keypad keys into ASCII characters
;; that people usually expect.
(let ((m (terminal-local-value 'function-key-map nil)))
(let ((m (terminal-local-value 'local-function-key-map nil)))
(define-key m [backspace] [?\d])
(define-key m [delete] [?\d])
(define-key m [tab] [?\t])
......@@ -1140,7 +1140,7 @@ correspoinding TextEncodingBase value."
(set-keyboard-coding-system (or coding-system 'mac-roman))
;; MacJapanese maps reverse solidus to ?\x80.
(if (eq coding-system 'japanese-shift-jis)
(define-key global-key-translation-map [?\x80] "\\"))))
(define-key key-translation-map [?\x80] "\\"))))
(define-key special-event-map [language-change] 'mac-handle-language-change)
......
......@@ -31,7 +31,7 @@
(if (boundp 'news-fkey-prefix)
nil
;; The terminal initialization should already have set up some keys
(setq news-fkey-prefix (lookup-key (terminal-local-value 'function-key-map nil) "\eO"))
(setq news-fkey-prefix (lookup-key (terminal-local-value 'local-function-key-map nil) "\eO"))
(if (not (keymapp news-fkey-prefix))
(error "What? Your news termcap/terminfo has no keycaps in it"))
......
......@@ -100,8 +100,8 @@
;; This way we don't override terminfo-derived settings or settings
;; made in the .emacs file.
(let ((m (copy-keymap rxvt-function-map)))
(set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil)))
(set-keymap-parent (terminal-local-value 'function-key-map nil) m))
(set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
(set-keymap-parent (terminal-local-value 'local-function-key-map nil) m))
;; Set up colors, for those versions of rxvt that support it.
......
......@@ -93,7 +93,7 @@
;;
(defvar sun-raw-prefix (make-sparse-keymap))
(define-key (terminal-local-value 'function-key-map nil) "\e[" sun-raw-prefix)
(define-key (terminal-local-value 'local-function-key-map nil) "\e[" sun-raw-prefix)
(define-key sun-raw-prefix "210z" [r3])
(define-key sun-raw-prefix "213z" [r6])
......
......@@ -28,14 +28,14 @@
;;; Code:
(or (lookup-key (terminal-local-value 'function-key-map nil) "\e[")
(define-key (terminal-local-value 'function-key-map nil) "\e[" (make-keymap)))
;; (or (lookup-key (terminal-local-value 'function-key-map nil) "\eO")
;; (define-key (terminal-local-value 'function-key-map nil) "\eO" (make-keymap)))
(or (lookup-key (terminal-local-value 'local-function-key-map nil) "\e[")
(define-key (terminal-local-value 'local-function-key-map nil) "\e[" (make-keymap)))
;; (or (lookup-key (terminal-local-value 'local-function-key-map nil) "\eO")
;; (define-key (terminal-local-value 'local-function-key-map nil) "\eO" (make-keymap)))
;; Miscellaneous keys
(mapcar (function (lambda (key-binding)
(define-key (terminal-local-value 'function-key-map nil)
(define-key (terminal-local-value 'local-function-key-map nil)
(car key-binding) (nth 1 key-binding))))
'(
;; These are set up by termcap or terminfo
......@@ -84,17 +84,17 @@
;; The numeric keypad keys.
(let ((i 0))
(while (< i 10)
(define-key (terminal-local-value 'function-key-map nil)
(define-key (terminal-local-value 'local-function-key-map nil)
(format "\eO%c" (+ i ?p))
(vector (intern (format "kp-%d" i))))
(setq i (1+ i))))
;; The numbered function keys.
(let ((i 0))
(while (< i 16)
(define-key (terminal-local-value 'function-key-map nil)
(define-key (terminal-local-value 'local-function-key-map nil)
(format "\e?%c" (+ i ?a))
(vector (intern (format "f%d" (1+ i)))))
(define-key (terminal-local-value 'function-key-map nil)
(define-key (terminal-local-value 'local-function-key-map nil)
(format "\e?%c" (+ i ?A))
(vector (intern (format "S-f%d" (1+ i)))))
(setq i (1+ i))))
......
......@@ -4,7 +4,7 @@
(load "term/vt100" nil t)
;; Make F11 an escape key.
(define-key function-key-map "\e[23~" [?\e])
(define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e])
;;; arch-tag: 0f78f583-9f32-4237-b106-28bcfff21d89
;;; vt200.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment