From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id RhNMO4F4cGMzdQAAbAwnHQ (envelope-from ) for ; Sun, 13 Nov 2022 05:54:26 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 4P6lOYF4cGMIJAEAG6o9tA (envelope-from ) for ; Sun, 13 Nov 2022 05:54:25 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9F914C5A8 for ; Sun, 13 Nov 2022 05:54:25 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ou4zv-0007EN-Rg; Sat, 12 Nov 2022 23:53:35 -0500 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 1ou4zu-0007B3-B9 for emacs-orgmode@gnu.org; Sat, 12 Nov 2022 23:53:34 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ou4zp-0002Y9-O0 for emacs-orgmode@gnu.org; Sat, 12 Nov 2022 23:53:34 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 11050240101 for ; Sun, 13 Nov 2022 05:53:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1668315206; bh=0uFLAn7TcK1ynyX4SyNPwchMhnGXgkAcjky54rNHOR8=; h=From:To:Cc:Subject:Date:From; b=WhhFHdsDmW8xJJQnA9Y/q6HZTymyjzOYZLtU/U4lfDONqBFTxNduWQJXO6FbUYkP3 l4fNfi0C9cYDn8UaPpcmbl9pav6XR4pEahMcitDnqra/3K/1mBiTjb3MKnpz2iRWjU lYFKU2sB40YVAXg+ydbvtwHZXJdw0OkabIYA70felrsvNtuPUbbFcpJBrVEJcLZROg HKOetU0ET+PKfwfYobMkOeXIqDhXkZCvs+oejqAC9fCYPiyFX6jD3mIHnvJYXn5KCf aBXEJS3uv0+B98byH62v6JmAjLcNHHIvcrWs/llrk54aGHDj6wvFnntjJ36Ds1FXRz WBYpN8zYtcOLQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N90Sg4j7Hz9rxL; Sun, 13 Nov 2022 05:53:23 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: Getting X selection reliably (Re: idea for capture anywhere in x) In-Reply-To: References: <87tuw31iub.fsf@mm.st> <87r0zelo7e.fsf@posteo.net> <875yg7qiyb.fsf@localhost> Date: Sun, 13 Nov 2022 04:54:04 +0000 Message-ID: <875yfj8nf7.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668315265; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=quLNpE4xNu/y5pIEOStsQZksX8Ac5oWwPxwYcys9SsE=; b=RLNXCLfWwlkbpZ/N6qAOheSCbS+ay5huI2LnZ20F6Mhdyf/6Fk0Rlq5E9Tx+OforQfk+FS rUOoNuW93V/E6m0vXvQB/WxebPjcq5wnpYdWOv0SxD5/IMrzQ8FWk4NQLRkHn9O+LwRPIM k5WX4kGgycAEr2R4kaXDk6RNgDA2XZw/8ODT/xo2O7qWLyUyPSDvcTS8fEZhYsreNCHUt/ 8b//XbC/tMzyrnLp87IyfHMhf9j3gUV2UKw7PxI5Ln1KZWRgAZ+Bn4vkg1x4PuQNsb25kT 2FmJ5EP/i6mJZKput7BxoIR+Ct/MU9LyrzgY/N0t4HgKX4UfiN8lBdG+OLwvNg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668315265; a=rsa-sha256; cv=none; b=EL+O5bBLL6/8XN9eKmzcti9C/cDSL/CUwU5qysSP//JRzIahixHpYE9UqDRejn6/rZJtD1 Sr5CvbDxmLQFG2vJsFBnH3WmC65ALgCLjaJLVqudi2GmWNROOxAW9keHMRCpu2V27eUYSZ MhlGPNJc+4CdB+iyRaRg1U+Op77EEDxHup2DMK3Vb6H9ki35GiSKIyJ53wIPlRbh3zdtOB s1blYfZpWyTq8w9DoHitGi3eUDUH1d+bID5B9lpJ12Rwn2yIHHtm87Apf6WZEajqhieMsE 5kncvfzRrVOKtGyGmChIBXCsQbl/Nd/U4aCY5be1Eges0aby9uvyc8bEBHlp5Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=WhhFHdsD; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -7.24 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=WhhFHdsD; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9F914C5A8 X-Spam-Score: -7.24 X-Migadu-Scanner: scn0.migadu.com X-TUID: HB7inWkpsyTp Max Nikulin writes: > On 26/10/2022 11:58, Ihor Radchenko wrote: >> >> Yes. From org-capture-templates docstring: >> >> %x Content of the X clipboard. > > Ihor, I am afraid there are a couple of pitfalls with "%x" for Samuel > since he prefers to keep Emacs hidden so can not check result. > > 1. If something goes wrong, e.g. some application does not put > highlighted text to PRIMARY selection then wrong source (CLIPBOARD) or > empty string may be silently captured. I would prefer explicit source > however it will not protect against stale selection from the same source. > > Simulate empty selection: > echo | xsel -bi ; echo | xsel -i ; killall xsel I am unsure what can be done here. AFAIU, Org just follows the %x description. Nothing wrong on Org side. The best we can do is alternative %?? that will do something more reliable. But I am unsure what it can be. > 2. Jean pointed out that Emacs ignores X selection if it does not have > an X frame. It was almost buried in the haystack of "SQL instead of Org" > noise. It happens if Emacs is running as a daemon. I am unsure which way > Samuel starts Emacs (xinit, systemd user session, systemd socket > activation, manually, etc.) May we modify org-get-x-clipboard adding (server-select-display (getenv \"DISPLAY\")) ? Will it be enough? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at