diff options
| author | Stefan Monnier | 2014-10-01 18:13:11 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2014-10-01 18:13:11 -0400 |
| commit | a8b36b953e3dc4d50dbfe430d5c579f7b1fd71e7 (patch) | |
| tree | cfbea5b3f0c9514911375ef68a290c193730bf22 /lisp/select.el | |
| parent | c59ef5ef53f8e33a693f1107c1d61535bbd3a187 (diff) | |
| download | emacs-a8b36b953e3dc4d50dbfe430d5c579f7b1fd71e7.tar.gz emacs-a8b36b953e3dc4d50dbfe430d5c579f7b1fd71e7.zip | |
Consolidate x-select-text.
* lisp/frame.el (gui-method, gui-method-define, gui-method-declare)
(gui-call): New macros.
(gui-method--name): New function.
(frame-creation-function-alist): Use gui-method-declare.
(make-frame): Use gui-method.
* lisp/select.el (gui-select-enable-clipboard): Rename from
x-select-enable-clipboard and move here.
(x-select-enable-clipboard): Define as obsolete alias.
(gui-last-selected-text): New var, to replace x-last-selected-text.
(gui-select-text): New GUI method.
(gui-select-text): New function.
(x-select-text): Define as obsolete alias.
* lisp/term/common-win.el (x-select-enable-clipboard, x-select-text):
Move to select.el.
* lisp/simple.el (interprogram-cut-function): Change default to
x-select-text.
(interprogram-paste-function): Change default to `ignore'.
* lisp/w32-common-fns.el (interprogram-cut-function): Don't modify.
* lisp/term/x-win.el (interprogram-cut-function): Don't modify.
(gui-select-text): Add method for x.
* lisp/term/w32-win.el (gui-select-text): Add method for w32.
* lisp/term/pc-win.el (x-last-selected-text): Remove, use
gui-last-selected-text instead.
(msdos-initialize-window-system): Don't set interprogram-cut-function.
(gui-select-text): Add method for pc.
* lisp/term/ns-win.el (ns-last-selected-text): Remove, use
gui-last-selected-text instead.
(gui-select-text): Add method for ns.
(x-setup-function-keys): Don't change interprogram-cut-function.
* lisp/loadup.el ("startup"): Load after "frame".
* lisp/subr.el (package--builtin-versions, package--description-file):
Move from startup.el.
* lisp/startup.el (package--builtin-versions, package--description-file):
Move to subr.el.
(handle-args-function-alist, window-system-initialization-alist):
Use gui-method-declare.
(command-line): Use gui-method.
* src/xselect.c (selection-converter-alist): Fix docstring.
Diffstat (limited to 'lisp/select.el')
| -rw-r--r-- | lisp/select.el | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lisp/select.el b/lisp/select.el index c4d020343af..c32b45f1c85 100644 --- a/lisp/select.el +++ b/lisp/select.el | |||
| @@ -77,6 +77,41 @@ After the communication, this variable is set to nil.") | |||
| 77 | ;; Only declared obsolete in 23.3. | 77 | ;; Only declared obsolete in 23.3. |
| 78 | (define-obsolete-function-alias 'x-selection 'x-get-selection "at least 19.34") | 78 | (define-obsolete-function-alias 'x-selection 'x-get-selection "at least 19.34") |
| 79 | 79 | ||
| 80 | (defcustom gui-select-enable-clipboard t | ||
| 81 | "Non-nil means cutting and pasting uses the clipboard. | ||
| 82 | This can be in addition to, but in preference to, the primary selection, | ||
| 83 | if applicable (i.e. under X11)." | ||
| 84 | :type 'boolean | ||
| 85 | :group 'killing | ||
| 86 | ;; The GNU/Linux version changed in 24.1, the MS-Windows version did not. | ||
| 87 | :version "24.1") | ||
| 88 | (define-obsolete-variable-alias 'x-select-enable-clipboard | ||
| 89 | 'gui-select-enable-clipboard "25.1") | ||
| 90 | |||
| 91 | (gui-method-declare gui-select-text #'ignore | ||
| 92 | "Method used to pass the current selection to the system. | ||
| 93 | Called with one argument (the text selected). | ||
| 94 | Should obey `gui-select-enable-clipboard' where applicable.") | ||
| 95 | |||
| 96 | (defvar gui-last-selected-text nil | ||
| 97 | "Last text passed to `gui-select-text'.") | ||
| 98 | |||
| 99 | (defun gui-select-text (text) | ||
| 100 | "Select TEXT, a string, according to the window system. | ||
| 101 | if `gui-select-enable-clipboard' is non-nil, copy TEXT to the system's clipboard. | ||
| 102 | |||
| 103 | On X, if `x-select-enable-primary' is non-nil, put TEXT in | ||
| 104 | the primary selection. | ||
| 105 | |||
| 106 | On MS-Windows, make TEXT the current selection." | ||
| 107 | ;; FIXME: We should test gui-select-enable-clipboard here! | ||
| 108 | ;; But that would break the independence between x-select-enable-primary | ||
| 109 | ;; and x-select-enable-clipboard! | ||
| 110 | ;;(when gui-select-enable-clipboard | ||
| 111 | (gui-call gui-select-text text) ;;) | ||
| 112 | (setq gui-last-selected-text text)) | ||
| 113 | (define-obsolete-function-alias 'x-select-text 'gui-select-text "25.1") | ||
| 114 | |||
| 80 | (defun x-get-selection (&optional type data-type) | 115 | (defun x-get-selection (&optional type data-type) |
| 81 | "Return the value of an X Windows selection. | 116 | "Return the value of an X Windows selection. |
| 82 | The argument TYPE (default `PRIMARY') says which selection, | 117 | The argument TYPE (default `PRIMARY') says which selection, |