changeset 111166:6cf6c01cf9bf

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.
author Glenn Morris <rgm@gnu.org>
date Sun, 24 Oct 2010 15:04:45 -0700
parents 6e6f966c3473
children 638eadc53a4f
files lisp/ChangeLog lisp/term/common-win.el lisp/term/ns-win.el lisp/term/w32-win.el lisp/term/x-win.el lisp/w32-fns.el
diffstat 6 files changed, 89 insertions(+), 125 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Oct 24 17:44:53 2010 -0400
+++ b/lisp/ChangeLog	Sun Oct 24 15:04:45 2010 -0700
@@ -1,3 +1,15 @@
+2010-10-24  Glenn Morris  <rgm@gnu.org>
+
+	* 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.
+
 2010-10-24  "T.V. Raman" <tv.raman.tv@gmail.com>
 
 	* net/mairix.el (mairix-searches-mode-map):
@@ -159,14 +171,13 @@
 	(set-cursor-color, set-mouse-color, set-border-color): Use
 	read-color.
 
-2010-10-24  Leo <sdl.web@gmail.com>
+2010-10-24  Leo  <sdl.web@gmail.com>
 
 	* eshell/em-unix.el (eshell-remove-entries): Use the TRASH
 	argument of delete-file and delete-directory (Bug#7011).
 
 2010-10-24  Chong Yidong  <cyd@stupidchicken.com>
 
-
 	* emacs-lisp/package.el (package-menu-mode-map): Inherit from
 	button-buffer-map.
 
--- a/lisp/term/common-win.el	Sun Oct 24 17:44:53 2010 -0400
+++ b/lisp/term/common-win.el	Sun Oct 24 15:04:45 2010 -0700
@@ -37,6 +37,67 @@
   ;; The GNU/Linux version changed in 24.1, the MS-Windows version did not.
   :version "24.1")
 
+(defvar x-last-selected-text)		; w32-fns.el
+(declare-function w32-set-clipboard-data "w32select.c"
+		  (string &optional ignored))
+
+(defun x-select-text (text)
+  "Select TEXT, a string, according to the window system.
+
+On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the
+clipboard.  If `x-select-enable-primary' is non-nil, put TEXT in
+the primary selection.
+
+On MS-Windows, make TEXT the current selection.  If
+`x-select-enable-clipboard' is non-nil, copy the text to the
+clipboard as well.
+
+On Nextstep, put TEXT in the pasteboard."
+  (if (eq system-type 'windows-nt)
+      (progn
+	(if x-select-enable-clipboard
+	    (w32-set-clipboard-data text))
+	(setq x-last-selected-text text))
+    ;; With multi-tty, this function may be called from a tty frame.
+    (when (eq (framep (selected-frame)) 'x)
+      (when x-select-enable-primary
+	(x-set-selection 'PRIMARY text)
+	(setq x-last-selected-text-primary text))
+      (when x-select-enable-clipboard
+	(x-set-selection 'CLIPBOARD text)
+	(setq x-last-selected-text-clipboard text)))))
+
+;;;; 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 [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])
+    (and (eq system-type 'windows-nt)
+	 (define-key map [S-tab] [backtab]))
+    map)
+  "Keymap of possible alternative meanings for some keys.")
+
+(defun x-setup-function-keys (frame)
+  "Set up `function-key-map' on the graphical frame FRAME."
+  ;; 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
+      (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)))
+
 (defvar x-invocation-args)
 
 (defvar x-command-line-resources nil)
@@ -382,4 +443,17 @@
 For Nextstep, this is a list of non-PANTONE colors returned by
 the operating system.")
 
+(defvar w32-color-map)
+
+(defun xw-defined-colors (&optional frame)
+  "Internal function called by `defined-colors', which see."
+  (or frame (setq frame (selected-frame)))
+  (let (defined-colors)
+    (dolist (this-color (if (eq system-type 'windows-nt)
+			    (or (mapcar 'car w32-color-map) x-colors)
+			  x-colors))
+      (and (color-supported-p this-color frame t)
+	   (setq defined-colors (cons this-color defined-colors))))
+    defined-colors))
+
 ;;; common-win.el ends here
--- a/lisp/term/ns-win.el	Sun Oct 24 17:44:53 2010 -0400
+++ b/lisp/term/ns-win.el	Sun Oct 24 15:04:45 2010 -0700
@@ -1028,7 +1028,7 @@
 clipboard.  If `x-select-enable-primary' is non-nil, put TEXT in
 the primary selection.
 
-On Windows, make TEXT the current selection.  If
+On MS-Windows, make TEXT the current selection.  If
 `x-select-enable-clipboard' is non-nil, copy the text to the
 clipboard as well.
 
--- a/lisp/term/w32-win.el	Sun Oct 24 17:44:53 2010 -0400
+++ b/lisp/term/w32-win.el	Sun Oct 24 15:04:45 2010 -0700
@@ -148,18 +148,8 @@
 (global-set-key [language-change] 'ignore)
 
 (defvar x-resource-name)
-(defvar x-colors)
 
 
-(defun xw-defined-colors (&optional frame)
-  "Internal function called by `defined-colors', which see."
-  (or frame (setq frame (selected-frame)))
-  (let ((defined-colors nil))
-    (dolist (this-color (or (mapcar 'car w32-color-map) x-colors))
-      (and (color-supported-p this-color frame t)
-	   (setq defined-colors (cons this-color defined-colors))))
-    defined-colors))
-
 ;;;; Function keys
 
  ;;; make f10 activate the real menubar rather than the mini-buffer menu
@@ -316,5 +306,4 @@
 
 (provide 'w32-win)
 
-;; arch-tag: 69fb1701-28c2-4890-b351-3d1fe4b4f166
 ;;; w32-win.el ends here
--- a/lisp/term/x-win.el	Sun Oct 24 17:44:53 2010 -0400
+++ b/lisp/term/x-win.el	Sun Oct 24 15:04:45 2010 -0700
@@ -1,7 +1,7 @@
 ;;; x-win.el --- parse relevant switches and set up for X  -*-coding: iso-2022-7bit;-*-
 
 ;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008, 2009, 2010 Free Software Foundation, Inc.
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals, i18n
@@ -252,50 +252,6 @@
 (defconst x-pointer-invisible 255)
 
 
-(defvar x-colors)
-
-(defun xw-defined-colors (&optional frame)
-  "Internal function called by `defined-colors', which see."
-  (or frame (setq frame (selected-frame)))
-  (let ((all-colors x-colors)
-	(this-color nil)
-	(defined-colors nil))
-    (while all-colors
-      (setq this-color (car all-colors)
-	    all-colors (cdr all-colors))
-      (and (color-supported-p this-color frame t)
-	   (setq defined-colors (cons this-color defined-colors))))
-    defined-colors))
-
-;;;; 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 [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 the graphical frame FRAME."
-  ;; 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
-      (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)))
-
 ;;;; Keysyms
 
 (defun vendor-specific-keysyms (vendor)
@@ -1212,27 +1168,6 @@
   :group 'killing
   :version "24.1")
 
-(defun x-select-text (text)
-  "Select TEXT, a string, according to the window system.
-
-On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the
-clipboard.  If `x-select-enable-primary' is non-nil, put TEXT in
-the primary selection.
-
-On Windows, make TEXT the current selection.  If
-`x-select-enable-clipboard' is non-nil, copy the text to the
-clipboard as well.
-
-On Nextstep, put TEXT in the pasteboard."
-  ;; With multi-tty, this function may be called from a tty frame.
-  (when (eq (framep (selected-frame)) 'x)
-    (when x-select-enable-primary
-      (x-set-selection 'PRIMARY text)
-      (setq x-last-selected-text-primary text))
-    (when x-select-enable-clipboard
-      (x-set-selection 'CLIPBOARD text)
-      (setq x-last-selected-text-clipboard text))))
-
 (defvar x-select-request-type nil
   "*Data type request for X selection.
 The value is one of the following data types, a list of them, or nil:
--- a/lisp/w32-fns.el	Sun Oct 24 17:44:53 2010 -0400
+++ b/lisp/w32-fns.el	Sun Oct 24 15:04:45 2010 -0700
@@ -32,34 +32,6 @@
 
 ;;;; 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 [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])
-    (define-key map [S-tab] [backtab])
-    map)
-  "Keymap of possible alternative meanings for some keys.")
-
-(defun x-setup-function-keys (frame)
-  "Set up `function-key-map' on the graphical frame FRAME."
-  ;; 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
-      (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)))
-
 (declare-function set-message-beep "w32console.c")
 (declare-function w32-get-clipboard-data "w32select.c")
 (declare-function w32-get-locale-info "w32proc.c")
@@ -432,22 +404,6 @@
 ;; from x-selection-value.
 (defvar x-last-selected-text nil)
 
-(defun x-select-text (text)
-  "Select TEXT, a string, according to the window system.
-
-On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the
-clipboard.  If `x-select-enable-primary' is non-nil, put TEXT in
-the primary selection.
-
-On Windows, make TEXT the current selection.  If
-`x-select-enable-clipboard' is non-nil, copy the text to the
-clipboard as well.
-
-On Nextstep, put TEXT in the pasteboard."
-  (if x-select-enable-clipboard
-      (w32-set-clipboard-data text))
-  (setq x-last-selected-text text))
-
 (defun x-get-selection-value ()
   "Return the value of the current selection.
 Consult the selection.  Treat empty strings as if they were unset."
@@ -503,5 +459,4 @@
   (delete-matching-lines "^$\\|^;")
   (save-buffers-kill-emacs t))
 
-;; arch-tag: c49b48cc-0f4f-454f-a274-c2dc34815e14
 ;;; w32-fns.el ends here