;;; x-win.el --- parse relevant switches and set up for X -*-coding: iso-2022-7bit;-*-
;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; 2005, 2006 Free Software Foundation, Inc.
;; Author: FSF
;; Keywords: terminals, i18n
initial-frame-alist)))
(defvar x-display-name nil
- "The X display name specifying server and X frame.")
+ "The name of the X display on which Emacs was started.
+
+For the X display name of individual frames, see the `display'
+frame parameter.")
(defun x-handle-display (switch)
+ "Handle -display DISPLAY option."
(setq x-display-name (car x-invocation-args)
x-invocation-args (cdr x-invocation-args))
;; Make subshell programs see the same DISPLAY value Emacs really uses.
(defun x-setup-function-keys (frame)
"Set up `function-key-map' on FRAME for the X window system."
- ;; 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])))
+ ;; Don't do this twice on the same display, or it would break
+ ;; normal-erase-is-backspace-mode.
+ (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]))
+ (set-terminal-parameter frame 'x-setup-function-keys t)))
;; These tell read-char how to convert
;; these special chars to ASCII.