diff options
| author | Elliott Shugerman <eeshugerman@gmail.com> | 2022-09-27 19:33:55 -0400 |
|---|---|---|
| committer | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2022-09-29 09:16:11 +0200 |
| commit | 9af2faf95992d36781cd697c9fcdbe108372ce3d (patch) | |
| tree | 30411218e94c11307068742a60adf0a757454779 | |
| parent | a8adc879addb71ef25741c70d4e6e1273b9f7620 (diff) | |
Fix pasting from ?+ in Emacs 29
| -rw-r--r-- | evil-common.el | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/evil-common.el b/evil-common.el index 7ae8feb..0ee6c14 100644 --- a/evil-common.el +++ b/evil-common.el @@ -2147,22 +2147,23 @@ The following special registers are supported. (and (< reg (length kill-ring)) (current-kill reg t)))) ((memq register '(?* ?+)) - ;; the following code is modified from - ;; `x-selection-value-internal' - (let ((what (if (eq register ?*) 'PRIMARY 'CLIPBOARD)) - (request-type (or (and (boundp 'x-select-request-type) - x-select-request-type) - '(UTF8_STRING COMPOUND_TEXT STRING))) - text) - (unless (consp request-type) - (setq request-type (list request-type))) - (while (and request-type (not text)) - (condition-case nil - (setq text (evil-get-selection what (pop request-type))) - (error nil))) - (when text - (remove-text-properties 0 (length text) '(foreign-selection nil) text)) - text)) + (let ((what (if (eq register ?*) 'PRIMARY 'CLIPBOARD))) + (if (version<= "25" emacs-version) + (gui--selection-value-internal what) + ;; the following code is modified from `x-selection-value-internal' + (let ((request-type (or (and (boundp 'x-select-request-type) + x-select-request-type) + '(UTF8_STRING COMPOUND_TEXT STRING))) + text) + (unless (consp request-type) + (setq request-type (list request-type))) + (while (and request-type (not text)) + (condition-case nil + (setq text (evil-get-selection what (pop request-type))) + (error nil))) + (when text + (remove-text-properties 0 (length text) '(foreign-selection nil) text)) + text)))) ((eq register ?\C-W) (unless (evil-ex-p) (user-error "Register <C-w> only available in ex state")) |
