X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/565c0ca57e89ab1a1b4c378c615a998eb8fc0f99..cc232200f77c373da233803992a70d2d30bb73ff:/lisp/term/x-win.el diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 1950bef19b..e3c42626a3 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1,7 +1,6 @@ ;;; 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. +;; Copyright (C) 1993-1994, 2001-2011 Free Software Foundation, Inc. ;; Author: FSF ;; Keywords: terminals, i18n @@ -252,50 +251,6 @@ exists." (defconst x-pointer-invisible 255) -(defvar x-colors) - -(defun xw-defined-colors (&optional frame) - "Internal function called by `defined-colors'." - (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) @@ -1206,54 +1161,34 @@ pasted text.") "The value of the PRIMARY X selection last time we selected or pasted text.") -(defcustom x-select-enable-clipboard t - "Non-nil means cutting and pasting uses the clipboard. -This is in addition to, but in preference to, the primary selection." - :type 'boolean - :group 'killing - :version "24.1") - (defcustom x-select-enable-primary nil "Non-nil means cutting and pasting uses the primary selection." :type 'boolean :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. +(defcustom 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: `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT' -If the value is one of the above symbols, try only the specified -type. +If the value is one of the above symbols, try only the specified type. If the value is a list of them, try each of them in the specified order until succeed. -The value nil is the same as this list: - \(UTF8_STRING COMPOUND_TEXT STRING) -") +The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING)." + :type '(choice (const :tag "Default" nil) + (const COMPOUND_TEXT) + (const UTF8_STRING) + (const STRING) + (const TEXT) + (set :tag "List of values" + (const COMPOUND_TEXT) + (const UTF8_STRING) + (const STRING) + (const TEXT))) + :group 'killing) ;; Get a selection value of type TYPE by calling x-get-selection with ;; an appropriate DATA-TYPE argument decided by `x-select-request-type'. @@ -1351,6 +1286,13 @@ The value nil is the same as this list: (setq interprogram-cut-function 'x-select-text) (setq interprogram-paste-function 'x-selection-value) +;; Make paste from other applications use the decoding in x-select-request-type +;; and not just STRING. +(defun x-get-selection-value () + "Get the current value of the PRIMARY selection. +Request data types in the order specified by `x-select-request-type'." + (x-selection-value-internal 'PRIMARY)) + (defun x-clipboard-yank () "Insert the clipboard contents, or the last stretch of killed text." (interactive "*") @@ -1640,5 +1582,4 @@ This uses `icon-map-list' to map icon file names to stock icon names." (provide 'x-win) -;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 ;;; x-win.el ends here