aboutsummaryrefslogtreecommitdiff
path: root/evil-common.el
diff options
context:
space:
mode:
authorEvgeni Kolev <evgenysw@gmail.com>2017-11-18 16:13:12 +0200
committerEvgeni Kolev <evgenysw@gmail.com>2017-11-19 17:59:13 +0200
commit53e0f2385f6e922b9a718c6069b1ecba60d59c72 (patch)
tree9f013652de38c6d2beb5a8981a93b751f2ba112a /evil-common.el
parentef276764ce17d8aa6b4b6fb90a7137d428ff6288 (diff)
Fix compile warning for deprecated x-set-selection, x-get-selection
Refs #952
Diffstat (limited to 'evil-common.el')
-rw-r--r--evil-common.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/evil-common.el b/evil-common.el
index 11f53e4..631563b 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -47,6 +47,13 @@ window commands not available.")
;;; Compatibility with different Emacs versions
+;; x-set-selection and x-get-selection have been deprecated since 25.1
+;; by gui-set-selection and gui-get-selection
+(defalias 'evil-get-selection
+ (if (fboundp 'gui-get-selection) 'gui-get-selection 'x-get-selection))
+(defalias 'evil-set-selection
+ (if (fboundp 'gui-set-selection) 'gui-set-selection 'x-set-selection))
+
(defmacro evil-called-interactively-p ()
"Wrapper for `called-interactively-p'.
In older versions of Emacs, `called-interactively-p' takes
@@ -2010,7 +2017,7 @@ The following special registers are supported.
(setq request-type (list request-type)))
(while (and request-type (not text))
(condition-case nil
- (setq text (x-get-selection what (pop request-type)))
+ (setq text (evil-get-selection what (pop request-type)))
(error nil)))
(when text
(remove-text-properties 0 (length text) '(foreign-selection nil) text))
@@ -2098,9 +2105,9 @@ register instead of replacing its content."
(current-kill (- register ?1))
(setcar kill-ring-yank-pointer text))))
((eq register ?*)
- (x-set-selection 'PRIMARY text))
+ (evil-set-selection 'PRIMARY text))
((eq register ?+)
- (x-set-selection 'CLIPBOARD text))
+ (evil-set-selection 'CLIPBOARD text))
((eq register ?-)
(setq evil-last-small-deletion text))
((eq register ?_) ; the black hole register