Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pasting from ?+ register in Emacs 29 #1677

Merged
merged 3 commits into from
Sep 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions evil-common.el
Original file line number Diff line number Diff line change
Expand Up @@ -2147,22 +2147,26 @@ 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<= "29" emacs-version)
(gui--selection-value-internal what)
;; The following code is based on `x-selection-value-internal'
;; (now `gui--selection-value-internal') circa Emacs 24. We're
;; unsure why exactly it's duplicated here, and it's possible
;; it needn't be for newer versions of Emacs.
(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"))
Expand Down