0

Have a way to paste the primary selection using this, but now I want the same functionality with multi-term. Using the function I wrote earlier just causes "Buffer is read-only: #<buffer *terminal<1>*>" to print out.

How do I gui-get-primary-selection to work with multi-term?

2

Something like this may help:

(add-hook 'term-mode-hook (lambda ()
              (define-key term-raw-map (kbd "C-y") 'term-paste)))
0

Looked into the code for term-paste and came up with the following

(defun term-primary-yank ()
 "Paste PRIMARY selection without mouse interaction."
 (interactive)
 (term-send-raw-string (gui-get-primary-selection)))

Adding a hook didn't seem to work. Had to set it in term-bind-key-alist under custom-set-variables as in (this could be due to something I have in my own .emacs):

(custom-set-variables
 '(term-bind-key-alist
   '(("C-M-y" . term-primary-yank))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.