[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: multiple kill and paste from X clipboard
From: |
Manuel Giraud |
Subject: |
Re: multiple kill and paste from X clipboard |
Date: |
Sun, 14 Jan 2024 16:58:36 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi,
FTR, I was able to get the behaviour I wanted with the following code.
So far, it has two drawbacks:
- it works with the primary selection and is, therefore, X11
only
- it does not work on Emacs itself (but we have better
alternatives here ;-)
--8<---------------cut here---------------start------------->8---
(defvar primary-list nil)
(defvar my-timer nil)
(defun next-primary (name type success)
(when (and (eq name 'PRIMARY)
(not (eq type 'TARGETS))
success
primary-list)
(gui-set-selection 'PRIMARY (pop primary-list))))
(defun clean-up-when-empty ()
(unless primary-list
(cancel-timer my-timer)
(setq my-timer nil)
(remove-hook 'x-sent-selection-functions 'next-primary)))
(defun put-list-into-primary (list)
(gui-set-selection 'PRIMARY (car list))
(setq primary-list (cdr list))
(add-hook 'x-sent-selection-functions 'next-primary)
(setq my-timer (run-with-timer t 1 'clean-up-when-empty)))
(defun test-me ()
(interactive)
(put-list-into-primary (list "hello" "how" "are" "you?")))
--8<---------------cut here---------------end--------------->8---
--
Manuel Giraud
- multiple kill and paste from X clipboard, Manuel Giraud, 2024/01/12
- Re: multiple kill and paste from X clipboard, Eli Zaretskii, 2024/01/12
- Re: multiple kill and paste from X clipboard, Manuel Giraud, 2024/01/12
- Re: multiple kill and paste from X clipboard, Manuel Giraud, 2024/01/12
- Re: multiple kill and paste from X clipboard, Po Lu, 2024/01/12
- Re: multiple kill and paste from X clipboard, Manuel Giraud, 2024/01/13
- Re: multiple kill and paste from X clipboard,
Manuel Giraud <=
- Re: multiple kill and paste from X clipboard, Stefan Monnier, 2024/01/14
- Re: multiple kill and paste from X clipboard, Manuel Giraud, 2024/01/15
- Re: multiple kill and paste from X clipboard, Manuel Giraud, 2024/01/17
- Re: multiple kill and paste from X clipboard, Stefan Monnier, 2024/01/31
Re: multiple kill and paste from X clipboard, orzodk, 2024/01/12