Move some more shared x-, w32- things to common-win.
authorGlenn Morris <rgm@gnu.org>
Sun, 24 Oct 2010 22:04:45 +0000 (15:04 -0700)
committerGlenn Morris <rgm@gnu.org>
Sun, 24 Oct 2010 22:04:45 +0000 (15:04 -0700)
* 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.

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

index 7cbe7d8..e2c5d1f 100644 (file)
@@ -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):
        (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.
 
index 832dde1..1c53f09 100644 (file)
@@ -37,6 +37,67 @@ accessible to other programs on MS-Windows.\)"
   ;; 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 X, the list comes from the `rgb.txt' file,v 10.41 94/02/20.
 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
index 0eb7322..acd6bda 100644 (file)
@@ -1028,7 +1028,7 @@ 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
+On MS-Windows, make TEXT the current selection.  If
 `x-select-enable-clipboard' is non-nil, copy the text to the
 clipboard as well.
 
index 54bb5a5..a1ab5a8 100644 (file)
@@ -148,18 +148,8 @@ the last file dropped is selected."
 (global-set-key [language-change] 'ignore)
 
 (defvar x-resource-name)
-(defvar x-colors)
 
 \f
-(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))
-\f
 ;;;; Function keys
 
  ;;; 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.")
 
 (provide 'w32-win)
 
-;; arch-tag: 69fb1701-28c2-4890-b351-3d1fe4b4f166
 ;;; w32-win.el ends here
index c39332c..bd42601 100644 (file)
@@ -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 @@ exists."
 (defconst x-pointer-invisible 255)
 
 \f
-(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))
-\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 [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)))
-\f
 ;;;; Keysyms
 
 (defun vendor-specific-keysyms (vendor)
@@ -1212,27 +1168,6 @@ pasted text.")
   :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:
index 1abb29f..0c6c56f 100644 (file)
 
 ;;;; 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 @@ bit output with no translation."
 ;; 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 @@ to include Sed, which is used by leim/Makefile.in to do the job."
   (delete-matching-lines "^$\\|^;")
   (save-buffers-kill-emacs t))
 
-;; arch-tag: c49b48cc-0f4f-454f-a274-c2dc34815e14
 ;;; w32-fns.el ends here