aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/term
diff options
context:
space:
mode:
authorGlenn Morris2010-10-24 15:04:45 -0700
committerGlenn Morris2010-10-24 15:04:45 -0700
commita44d921f06db9b6bb43fa00bf291f2fb6737da71 (patch)
tree367e612b4ee41ad0d5b4702a77588400c501dae2 /lisp/term
parenta11de514760cb39dab01081fbe1342924b351c9c (diff)
downloademacs-a44d921f06db9b6bb43fa00bf291f2fb6737da71.tar.gz
emacs-a44d921f06db9b6bb43fa00bf291f2fb6737da71.zip
Move some more shared x-, w32- things to common-win.
* term/ns-win.el (x-select-text): Doc fix. * w32-fns.el (x-alternatives-map, x-setup-function-keys) (x-select-text): Move to term/common-win. * term/w32-win.el (xw-defined-colors): Move to common-win. * term/x-win.el (xw-defined-colors, x-alternatives-map) (x-setup-function-keys, x-select-text): Move to common-win. * term/common-win.el (x-select-text, x-alternatives-map) (x-setup-function-keys, xw-defined-colors): Merge x- and w32- definitions here.
Diffstat (limited to 'lisp/term')
-rw-r--r--lisp/term/common-win.el74
-rw-r--r--lisp/term/ns-win.el2
-rw-r--r--lisp/term/w32-win.el11
-rw-r--r--lisp/term/x-win.el67
4 files changed, 76 insertions, 78 deletions
diff --git a/lisp/term/common-win.el b/lisp/term/common-win.el
index 832dde1d8a1..1c53f09abad 100644
--- a/lisp/term/common-win.el
+++ b/lisp/term/common-win.el
@@ -37,6 +37,67 @@ accessible to other programs on MS-Windows.\)"
37 ;; The GNU/Linux version changed in 24.1, the MS-Windows version did not. 37 ;; The GNU/Linux version changed in 24.1, the MS-Windows version did not.
38 :version "24.1") 38 :version "24.1")
39 39
40(defvar x-last-selected-text) ; w32-fns.el
41(declare-function w32-set-clipboard-data "w32select.c"
42 (string &optional ignored))
43
44(defun x-select-text (text)
45 "Select TEXT, a string, according to the window system.
46
47On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the
48clipboard. If `x-select-enable-primary' is non-nil, put TEXT in
49the primary selection.
50
51On MS-Windows, make TEXT the current selection. If
52`x-select-enable-clipboard' is non-nil, copy the text to the
53clipboard as well.
54
55On Nextstep, put TEXT in the pasteboard."
56 (if (eq system-type 'windows-nt)
57 (progn
58 (if x-select-enable-clipboard
59 (w32-set-clipboard-data text))
60 (setq x-last-selected-text text))
61 ;; With multi-tty, this function may be called from a tty frame.
62 (when (eq (framep (selected-frame)) 'x)
63 (when x-select-enable-primary
64 (x-set-selection 'PRIMARY text)
65 (setq x-last-selected-text-primary text))
66 (when x-select-enable-clipboard
67 (x-set-selection 'CLIPBOARD text)
68 (setq x-last-selected-text-clipboard text)))))
69
70;;;; Function keys
71
72(defvar x-alternatives-map
73 (let ((map (make-sparse-keymap)))
74 ;; Map certain keypad keys into ASCII characters that people usually expect.
75 (define-key map [M-backspace] [?\M-\d])
76 (define-key map [M-delete] [?\M-\d])
77 (define-key map [M-tab] [?\M-\t])
78 (define-key map [M-linefeed] [?\M-\n])
79 (define-key map [M-clear] [?\M-\C-l])
80 (define-key map [M-return] [?\M-\C-m])
81 (define-key map [M-escape] [?\M-\e])
82 (define-key map [iso-lefttab] [backtab])
83 (define-key map [S-iso-lefttab] [backtab])
84 (and (eq system-type 'windows-nt)
85 (define-key map [S-tab] [backtab]))
86 map)
87 "Keymap of possible alternative meanings for some keys.")
88
89(defun x-setup-function-keys (frame)
90 "Set up `function-key-map' on the graphical frame FRAME."
91 ;; Don't do this twice on the same display, or it would break
92 ;; normal-erase-is-backspace-mode.
93 (unless (terminal-parameter frame 'x-setup-function-keys)
94 ;; Map certain keypad keys into ASCII characters that people usually expect.
95 (with-selected-frame frame
96 (let ((map (copy-keymap x-alternatives-map)))
97 (set-keymap-parent map (keymap-parent local-function-key-map))
98 (set-keymap-parent local-function-key-map map)))
99 (set-terminal-parameter frame 'x-setup-function-keys t)))
100
40(defvar x-invocation-args) 101(defvar x-invocation-args)
41 102
42(defvar x-command-line-resources nil) 103(defvar x-command-line-resources nil)
@@ -382,4 +443,17 @@ For X, the list comes from the `rgb.txt' file,v 10.41 94/02/20.
382For Nextstep, this is a list of non-PANTONE colors returned by 443For Nextstep, this is a list of non-PANTONE colors returned by
383the operating system.") 444the operating system.")
384 445
446(defvar w32-color-map)
447
448(defun xw-defined-colors (&optional frame)
449 "Internal function called by `defined-colors', which see."
450 (or frame (setq frame (selected-frame)))
451 (let (defined-colors)
452 (dolist (this-color (if (eq system-type 'windows-nt)
453 (or (mapcar 'car w32-color-map) x-colors)
454 x-colors))
455 (and (color-supported-p this-color frame t)
456 (setq defined-colors (cons this-color defined-colors))))
457 defined-colors))
458
385;;; common-win.el ends here 459;;; common-win.el ends here
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 0eb7322c618..acd6bda60f0 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1028,7 +1028,7 @@ On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the
1028clipboard. If `x-select-enable-primary' is non-nil, put TEXT in 1028clipboard. If `x-select-enable-primary' is non-nil, put TEXT in
1029the primary selection. 1029the primary selection.
1030 1030
1031On Windows, make TEXT the current selection. If 1031On MS-Windows, make TEXT the current selection. If
1032`x-select-enable-clipboard' is non-nil, copy the text to the 1032`x-select-enable-clipboard' is non-nil, copy the text to the
1033clipboard as well. 1033clipboard as well.
1034 1034
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 54bb5a5027b..a1ab5a8225c 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -148,18 +148,8 @@ the last file dropped is selected."
148(global-set-key [language-change] 'ignore) 148(global-set-key [language-change] 'ignore)
149 149
150(defvar x-resource-name) 150(defvar x-resource-name)
151(defvar x-colors)
152 151
153 152
154(defun xw-defined-colors (&optional frame)
155 "Internal function called by `defined-colors', which see."
156 (or frame (setq frame (selected-frame)))
157 (let ((defined-colors nil))
158 (dolist (this-color (or (mapcar 'car w32-color-map) x-colors))
159 (and (color-supported-p this-color frame t)
160 (setq defined-colors (cons this-color defined-colors))))
161 defined-colors))
162
163;;;; Function keys 153;;;; Function keys
164 154
165 ;;; make f10 activate the real menubar rather than the mini-buffer menu 155 ;;; make f10 activate the real menubar rather than the mini-buffer menu
@@ -316,5 +306,4 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
316 306
317(provide 'w32-win) 307(provide 'w32-win)
318 308
319;; arch-tag: 69fb1701-28c2-4890-b351-3d1fe4b4f166
320;;; w32-win.el ends here 309;;; w32-win.el ends here
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index c39332cc12b..bd426012532 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1,7 +1,7 @@
1;;; x-win.el --- parse relevant switches and set up for X -*-coding: iso-2022-7bit;-*- 1;;; x-win.el --- parse relevant switches and set up for X -*-coding: iso-2022-7bit;-*-
2 2
3;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 3;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4;; 2008, 2009, 2010 Free Software Foundation, Inc. 4;; 2008, 2009, 2010 Free Software Foundation, Inc.
5 5
6;; Author: FSF 6;; Author: FSF
7;; Keywords: terminals, i18n 7;; Keywords: terminals, i18n
@@ -252,50 +252,6 @@ exists."
252(defconst x-pointer-invisible 255) 252(defconst x-pointer-invisible 255)
253 253
254 254
255(defvar x-colors)
256
257(defun xw-defined-colors (&optional frame)
258 "Internal function called by `defined-colors', which see."
259 (or frame (setq frame (selected-frame)))
260 (let ((all-colors x-colors)
261 (this-color nil)
262 (defined-colors nil))
263 (while all-colors
264 (setq this-color (car all-colors)
265 all-colors (cdr all-colors))
266 (and (color-supported-p this-color frame t)
267 (setq defined-colors (cons this-color defined-colors))))
268 defined-colors))
269
270;;;; Function keys
271
272(defvar x-alternatives-map
273 (let ((map (make-sparse-keymap)))
274 ;; Map certain keypad keys into ASCII characters that people usually expect.
275 (define-key map [M-backspace] [?\M-\d])
276 (define-key map [M-delete] [?\M-\d])
277 (define-key map [M-tab] [?\M-\t])
278 (define-key map [M-linefeed] [?\M-\n])
279 (define-key map [M-clear] [?\M-\C-l])
280 (define-key map [M-return] [?\M-\C-m])
281 (define-key map [M-escape] [?\M-\e])
282 (define-key map [iso-lefttab] [backtab])
283 (define-key map [S-iso-lefttab] [backtab])
284 map)
285 "Keymap of possible alternative meanings for some keys.")
286
287(defun x-setup-function-keys (frame)
288 "Set up `function-key-map' on the graphical frame FRAME."
289 ;; Don't do this twice on the same display, or it would break
290 ;; normal-erase-is-backspace-mode.
291 (unless (terminal-parameter frame 'x-setup-function-keys)
292 ;; Map certain keypad keys into ASCII characters that people usually expect.
293 (with-selected-frame frame
294 (let ((map (copy-keymap x-alternatives-map)))
295 (set-keymap-parent map (keymap-parent local-function-key-map))
296 (set-keymap-parent local-function-key-map map)))
297 (set-terminal-parameter frame 'x-setup-function-keys t)))
298
299;;;; Keysyms 255;;;; Keysyms
300 256
301(defun vendor-specific-keysyms (vendor) 257(defun vendor-specific-keysyms (vendor)
@@ -1212,27 +1168,6 @@ pasted text.")
1212 :group 'killing 1168 :group 'killing
1213 :version "24.1") 1169 :version "24.1")
1214 1170
1215(defun x-select-text (text)
1216 "Select TEXT, a string, according to the window system.
1217
1218On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the
1219clipboard. If `x-select-enable-primary' is non-nil, put TEXT in
1220the primary selection.
1221
1222On Windows, make TEXT the current selection. If
1223`x-select-enable-clipboard' is non-nil, copy the text to the
1224clipboard as well.
1225
1226On Nextstep, put TEXT in the pasteboard."
1227 ;; With multi-tty, this function may be called from a tty frame.
1228 (when (eq (framep (selected-frame)) 'x)
1229 (when x-select-enable-primary
1230 (x-set-selection 'PRIMARY text)
1231 (setq x-last-selected-text-primary text))
1232 (when x-select-enable-clipboard
1233 (x-set-selection 'CLIPBOARD text)
1234 (setq x-last-selected-text-clipboard text))))
1235
1236(defvar x-select-request-type nil 1171(defvar x-select-request-type nil
1237 "*Data type request for X selection. 1172 "*Data type request for X selection.
1238The value is one of the following data types, a list of them, or nil: 1173The value is one of the following data types, a list of them, or nil: