diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-10-01 18:13:11 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-10-01 18:13:11 -0400 |
commit | a8b36b953e3dc4d50dbfe430d5c579f7b1fd71e7 (patch) | |
tree | cfbea5b3f0c9514911375ef68a290c193730bf22 /lisp/term/x-win.el | |
parent | c59ef5ef53f8e33a693f1107c1d61535bbd3a187 (diff) | |
download | emacs-a8b36b953e3dc4d50dbfe430d5c579f7b1fd71e7.tar.gz |
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/term/x-win.el')
-rw-r--r-- | lisp/term/x-win.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 964b9112553..daaef61e494 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1217,8 +1217,6 @@ The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING)." (remove-text-properties 0 (length text) '(foreign-selection nil) text)) text)) -(defvar x-select-enable-clipboard) ; common-win - ;; Return the value of the current X selection. ;; Consult the selection. Treat empty strings as if they were unset. ;; If this function is called twice and finds the same text, @@ -1290,7 +1288,6 @@ The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING)." 'x-selection-value "24.1") ;; Arrange for the kill and yank functions to set and check the clipboard. -(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 @@ -1301,6 +1298,7 @@ Request data types in the order specified by `x-select-request-type'." (x-selection-value-internal 'PRIMARY)) (defun x-clipboard-yank () + ;; FIXME: How is that different from `clipboard-yank'? "Insert the clipboard contents, or the last stretch of killed text." (interactive "*") (let ((clipboard-text (x-selection-value-internal 'CLIPBOARD)) @@ -1463,9 +1461,23 @@ This returns an error if any Emacs frames are X frames, or always under W32." (setq x-initialized t)) (add-to-list 'display-format-alist '("\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" . x)) -(add-to-list 'handle-args-function-alist '(x . x-handle-args)) -(add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces)) -(add-to-list 'window-system-initialization-alist '(x . x-initialize-window-system)) +(gui-method-define handle-args-function x #'x-handle-args) +(gui-method-define frame-creation-function x #'x-create-frame-with-faces) +(gui-method-define window-system-initialization x #'x-initialize-window-system) + +(defvar x-select-enable-primary) ; x-win.el +(gui-method-define gui-select-text x + (lambda (text) + (when x-select-enable-primary + (x-set-selection 'PRIMARY text) + (setq x-last-selected-text-primary text)) + (when x-select-enable-clipboard + ;; When cutting, the selection is cleared and PRIMARY + ;; set to the empty string. Prevent that, PRIMARY + ;; should not be reset by cut (Bug#16382). + (setq saved-region-selection text) + (x-set-selection 'CLIPBOARD text) + (setq x-last-selected-text-clipboard text)))) ;; Initiate drag and drop (add-hook 'after-make-frame-functions 'x-dnd-init-frame) |