From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: multiple kill and paste from X clipboard Date: Sun, 14 Jan 2024 16:58:36 +0100 Message-ID: <871qajykib.fsf@ledu-giraud.fr> References: <874jfi1s5l.fsf@ledu-giraud.fr> <83h6jiimbw.fsf@gnu.org> <87zfxazdxs.fsf@ledu-giraud.fr> <87wmse12tb.fsf@yahoo.com> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1763"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Manuel Giraud via Users list for the GNU Emacs text editor , Eli Zaretskii To: Po Lu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 14 16:59:25 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rP2tP-0000OV-UX for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 14 Jan 2024 16:59:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rP2so-0005EP-Vi; Sun, 14 Jan 2024 10:58:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rP2sm-0005Bw-W5 for help-gnu-emacs@gnu.org; Sun, 14 Jan 2024 10:58:45 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rP2sk-0003We-OR; Sun, 14 Jan 2024 10:58:44 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=WLa3WoZ6 ijVPb6NEWNv6NdWc5GkTkPNcQu/yQf8KriY=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=H4z42hF88SEycPttg64UaVupXHeCAl 7a9eCBMlOe7GVm/oZeu74rKe63+xQ4rO1UyhL443HSC7ORUm94c/iADA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=WLa3WoZ6ijVPb6NE WNv6NdWc5GkTkPNcQu/yQf8KriY=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=kZbIEG16VzsCCdwTgFsRdlvuRVORzs4i30V8z4 76zPZ28WlzJ96JpHhibDKwMUW7DpTYC6DWehxJv6M7oVLbEqXXUAsRLKzGGRpJtzCG6+qM oe2QT/g5fNPQe1VJvUSVF6lAzlwMZAYJEKNb1LvJeU23HGsdy9tTYb7wHVCWwCer0OqCH3 xZS1ywaTsZ2/rzZl5mdzunpIoZc+QLEEO2MiZw8x5r7y1q3rVO8lswuEeiYDvFcWixGL6C 5OXu0tb7cpmjqrR9m677zisdNTnmEokAFq31WHb2lWZEWqIbkrHChm/t0uw7UntDSaxsMU QWVXqeJtnYt1kJ4rfcWMd6Lg== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id df9bdd35 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 14 Jan 2024 16:58:38 +0100 (CET) In-Reply-To: <87wmse12tb.fsf@yahoo.com> (Po Lu's message of "Sat, 13 Jan 2024 08:42:40 +0800") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145730 Archived-At: 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