Manuel Giraud via Users list for the GNU Emacs text editor writes: > Stefan Monnier via Users list for the GNU Emacs text editor > writes: > >>> (add-hook 'x-sent-selection-functions 'next-primary) >> >> That's what I was about to suggest. I've never seen it used until now, >> so I wouldn't be surprised if it's quirky, tho. > > Yes, I've tested it lightly and it is not 100% reliable: sometimes it > works and sometimes I just get one in two selections. Hi, I'm still toying with this idea with the following Lisp code (no more timer involved): --8<---------------cut here---------------start------------->8--- (defvar primary-list nil) (defun next-primary (name type success) (when (and (eq name 'PRIMARY) (not (eq type 'TARGETS)) success) (if primary-list (gui-set-selection 'PRIMARY (pop primary-list)) ;; Remove me and clear PRIMARY (remove-hook 'x-sent-selection-functions 'next-primary) (gui-set-selection 'PRIMARY "")))) (defun successively-in-primary (list) (add-hook 'x-sent-selection-functions 'next-primary) (gui-set-selection 'PRIMARY (car list)) (setq primary-list (cdr list))) (defun test-me () (interactive) (successively-in-primary (list "hello" "how" "are" "you?"))) --8<---------------cut here---------------end--------------->8--- As I said previously, it works with some X client (like xterm) but with a more useful one (Firefox) I just get half of the selections. I tried to debug this and it seems to me that it is because Firefox issues some "PRIMARY TARGETS" requests that ends up « consuming » the user data (I'm not sure this is what happen but this is my interpretation of it). Anyway, I have put the following patch in place and it solves this issue with Firefox. Maybe Po you have an idea of what is going on here? Thanks.