summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-10-01 23:19:32 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-10-01 23:19:32 -0400
commit31300bee24ddcfd7dc27e757513d3c176a7fad83 (patch)
tree28aba34a75aeafb3246cb60f2c8c55d3043436f8 /lisp/mouse.el
parentc7c0acd47bad506647ca3445aba1ced77d201daf (diff)
downloademacs-31300bee24ddcfd7dc27e757513d3c176a7fad83.tar.gz
Consolidate management/ownership of selections.
* lisp/select.el (gui-get-selection-alist): New method. (gui-get-selection): Use it. Rename from x-get-selection. (x-get-selection): Define as obsolete alias. (x-get-clipboard): Mark obsolete. (gui-get-primary-selection): New function. (x-get-selection-value): Mark obsolete. (gui-own-selection-alist, gui-disown-selection-alist) (gui-selection-owner-p-alist): New methods. (gui-set-selection): Use them. Rename from x-set-selection. (x-set-selection): Define as obsolete alias. (gui--valid-simple-selection-p): Rename from x-valid-simple-selection-p. * lisp/w32-common-fns.el (gui-own-selection, gui-disown-selection) (gui-selection-owner-p, gui-get-selection): Define for w32. (w32-get-selection-value): Rename from x-get-selection-value. Use the new gui-last-selected-text. * lisp/term/x-win.el (x-get-selection-value): Remove. (x-clipboard-yank): Declare obsolete. (gui-own-selection, gui-disown-selection, gui-get-selection) (gui-selection-owner-p): Define for x. * lisp/term/w32-win.el (w32-win-suspend-error): Rename from x-win-suspend-error. * lisp/term/pc-win.el (w16-get-selection-value): Rename from x-get-selection-value. (w16-selection-owner-p): Rename from x-selection-owner-p. (gui-own-selection, gui-disown-selection, gui-get-selection) (gui-selection-owner-p): Define for pc. (w16--select-text): New function. * lisp/term/ns-win.el (gui-own-selection, gui-disown-selection) (gui-get-selection, gui-selection-owner-p): Define for ns. * lisp/term.el (term-mouse-paste): * lisp/mouse.el (mouse-yank-primary): Use gui-get-primary-selection. * src/nsselect.m (ns-own-selection-internal, ns-disown-selection-internal): Rename from the "x-" prefix.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el27
1 files changed, 5 insertions, 22 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 93bd6283158..f569ec3577d 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1068,24 +1068,7 @@ regardless of where you click."
(let (select-active-regions)
(deactivate-mark)))
(or mouse-yank-at-point (mouse-set-point click))
- (let ((primary
- (if (fboundp 'x-get-selection-value)
- (if (eq (framep (selected-frame)) 'w32)
- ;; MS-Windows emulates PRIMARY in x-get-selection, but not
- ;; in x-get-selection-value (the latter only accesses the
- ;; clipboard). So try PRIMARY first, in case they selected
- ;; something with the mouse in the current Emacs session.
- (or (x-get-selection 'PRIMARY)
- (x-get-selection-value))
- ;; Else MS-DOS or X.
- ;; On X, x-get-selection-value supports more formats and
- ;; encodings, so use it in preference to x-get-selection.
- (or (x-get-selection-value)
- (x-get-selection 'PRIMARY)))
- ;; FIXME: What about xterm-mouse-mode etc.?
- (x-get-selection 'PRIMARY))))
- (unless primary
- (error "No selection is available"))
+ (let ((primary (gui-get-primary-selection)))
(push-mark (point))
(insert-for-yank primary)))
@@ -1272,7 +1255,7 @@ This must be bound to a mouse drag event."
(if (numberp (posn-point posn))
(setq beg (posn-point posn)))
(move-overlay mouse-secondary-overlay beg (posn-point end))
- (x-set-selection
+ (gui-set-selection
'SECONDARY
(buffer-substring (overlay-start mouse-secondary-overlay)
(overlay-end mouse-secondary-overlay))))))
@@ -1347,13 +1330,13 @@ The function returns a non-nil value if it creates a secondary selection."
(if (marker-position mouse-secondary-start)
(save-window-excursion
(delete-overlay mouse-secondary-overlay)
- (x-set-selection 'SECONDARY nil)
+ (gui-set-selection 'SECONDARY nil)
(select-window start-window)
(save-excursion
(goto-char mouse-secondary-start)
(sit-for 1)
nil))
- (x-set-selection
+ (gui-set-selection
'SECONDARY
(buffer-substring (overlay-start mouse-secondary-overlay)
(overlay-end mouse-secondary-overlay)))))))))
@@ -1486,7 +1469,7 @@ CLICK position, kill the secondary selection."
(setq str (buffer-substring (overlay-start mouse-secondary-overlay)
(overlay-end mouse-secondary-overlay)))
(> (length str) 0)
- (x-set-selection 'SECONDARY str))))
+ (gui-set-selection 'SECONDARY str))))
(defcustom mouse-buffer-menu-maxlen 20