;;; mouse-sel.el --- multi-click selection support
-;; Copyright (C) 1993-1995, 2001-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2001-2016 Free Software Foundation, Inc.
;; Author: Mike Williams <mdub@bigfoot.com>
;; Keywords: mouse
;; In this mode, mouse-insert-selection just calls mouse-yank-at-click.
;;
;; Selection/kill-ring interaction is retained
-;; interprogram-cut-function = x-select-text
-;; interprogram-paste-function = x-selection-value
+;; interprogram-cut-function = gui-select-text
+;; interprogram-paste-function = gui-selection-value
;;
;; What you lose is the ability to select some text in
;; delete-selection-mode and yank over the top of it.
;;=== User Command ========================================================
-(defvar mouse-sel-has-been-enabled nil
- "Non-nil if Mouse Sel mode has been enabled at least once.")
-
(defvar mouse-sel-original-bindings nil)
-(defvar mouse-sel-original-interprogram-cut-function nil)
-(defvar mouse-sel-original-interprogram-paste-function nil)
+
+(defalias 'mouse-sel--ignore #'ignore)
;;;###autoload
(define-minor-mode mouse-sel-mode
(global-set-key event (cdr binding)))))
mouse-sel-bound-events))
;; Update interprogram functions.
- (setq mouse-sel-original-interprogram-cut-function
- interprogram-cut-function
- mouse-sel-original-interprogram-paste-function
- interprogram-paste-function
- mouse-sel-has-been-enabled t)
(unless (eq mouse-sel-default-bindings 'interprogram-cut-paste)
- (setq interprogram-cut-function nil
- interprogram-paste-function nil))))
+ (add-function :override interprogram-cut-function
+ #'mouse-sel--ignore)
+ (add-function :override interprogram-paste-function
+ #'mouse-sel--ignore))))
;; Restore original bindings
(remove-hook 'x-lost-selection-functions 'mouse-sel-lost-selection-hook)
(global-set-key (car binding) (cdr binding)))
;; Restore the old values of these variables,
;; only if they were actually saved previously.
- (if mouse-sel-has-been-enabled
- (setq interprogram-cut-function
- mouse-sel-original-interprogram-cut-function
- interprogram-paste-function
- mouse-sel-original-interprogram-paste-function))))
+ (remove-function interprogram-cut-function #'mouse-sel--ignore)
+ (remove-function interprogram-paste-function #'mouse-sel--ignore)))
(make-obsolete 'mouse-sel-mode "use the normal mouse modes" "24.3")
SELECTION-THING-SYMBOL = name of variable where the current selection
type for this selection should be stored.")
-(declare-function x-select-text "term/common-win" (text))
-
(defvar mouse-sel-set-selection-function
(if (eq mouse-sel-default-bindings 'interprogram-cut-paste)
- 'x-set-selection
+ 'gui-set-selection
(lambda (selection value)
(if (eq selection 'PRIMARY)
- (x-select-text value)
- (x-set-selection selection value))))
+ (gui-select-text value)
+ (gui-set-selection selection value))))
"Function to call to set selection.
Called with two arguments:
This sets the selection, unless `mouse-sel-default-bindings'
is `interprogram-cut-paste'.")
-(declare-function x-selection-value "term/x-win" ())
(defvar mouse-sel-get-selection-function
(lambda (selection)
(if (eq selection 'PRIMARY)
- (or (x-selection-value)
- (bound-and-true-p x-last-selected-text)
- (bound-and-true-p x-last-selected-text-primary))
- (x-get-selection selection)))
+ (or (gui-selection-value)
+ (bound-and-true-p x-last-selected-text-primary)
+ gui--last-selected-text-primary)
+ (gui-get-selection selection)))
"Function to call to get the selection.
Called with one argument: