;;; 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-2012 Free Software Foundation, Inc.
;; Author: FSF
;; Keywords: terminals, i18n
(defun emacs-session-save ()
"This function is called when the window system is shutting down.
-If this function returns non-nil, the window system shutdown is cancelled.
+If this function returns non-nil, the window system shutdown is canceled.
When a session manager tells Emacs that the window system is shutting
down, this function is called. It calls the functions in the hook
(defconst x-pointer-invisible 255)
\f
-(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))
-\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)
"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'.
(if (string= clip-text "") (setq clip-text nil))
;; Check the CLIPBOARD selection for 'newness', is it different
- ;; from what we remebered them to be last time we did a
+ ;; from what we remembered them to be last time we did a
;; cut/paste operation.
(setq clip-text
(cond ;; check clipboard
(when x-select-enable-primary
(setq primary-text (x-selection-value-internal 'PRIMARY))
;; Check the PRIMARY selection for 'newness', is it different
- ;; from what we remebered them to be last time we did a
+ ;; from what we remembered them to be last time we did a
;; cut/paste operation.
(setq primary-text
(cond ;; check primary selection
(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 "*")
(provide 'x-win)
-;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
;;; x-win.el ends here