From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 8JU2EfDWcmPyJAEAbAwnHQ (envelope-from ) for ; Tue, 15 Nov 2022 01:01:52 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id WKoUEfDWcmNeoQAAauVa8A (envelope-from ) for ; Tue, 15 Nov 2022 01:01:52 +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 0774738EE1 for ; Tue, 15 Nov 2022 01:01:52 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ouirJ-0004kd-KE; Mon, 14 Nov 2022 18:27:21 -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 1ouih8-0001hU-8x for emacs-orgmode@gnu.org; Mon, 14 Nov 2022 18:16:51 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ouOrA-00046N-9Z for emacs-orgmode@gnu.org; Sun, 13 Nov 2022 21:05:54 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 95363240026 for ; Mon, 14 Nov 2022 03:05:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1668391549; bh=bG1NCaHNe1SWZiXZu69oYN1lLIbZZ449j1hpC9KkpHs=; h=From:To:Cc:Subject:Date:From; b=iixn16A5PV1lRbUkFHjjXHlexFiAZd7Bc4VhGe0MLwyDjAW54WVG7aVe2xomEF24f sOoEOnLOC3mgojzD1rqH6JADGqKWDGbpKS6LzaExSW5fLxwWqA1CXFcu3v0QKAsWHo HsjO9K1wH9elrH3ntNIfYRnAqORtllSMhkn4FaFtjyHNlvGEFa1/vJ/fctzyrZwrMJ nYZMNiF8N3ED8vE8dVavBv7sVCCerhy/jDpC0XbrWAwZHXNEQ6DRcislNs6uFIcRyH ENELDWSpP1Lb8s21Hix+jO9UEqoDznACZg2zd52gAn3PWWtexkfP8GIBO+JI4RW4Yn Zio/S9iB9Ne/w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N9Xhn4fTmz9rxK; Mon, 14 Nov 2022 03:05:45 +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> <875yfj8nf7.fsf@localhost> Date: Mon, 14 Nov 2022 02:06:26 +0000 Message-ID: <877czyguhp.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.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, 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=1668470512; 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=b9p4nP88+/gr2DlE5iUXnexIZs+zwA77YH3o+nMYe28=; b=DifJMgIAZkpQTIsJJCHl7U8EpcettyGgziJk0fXwCkHpTlRFgNw4EI2AJ8vVwskU9m6A7K 1vJbK9kMFN7/NaRtwsRWPq8LHSM9Zw3oH/jpfQ4mVNwcdJeMxcLFwisIxx1/3+ILSfa19U 5u1CCKUSgEExEUIBupxY9QZkZ4wivjyXpwbGA7/zqRj0NpykaQsWBdjf49jimsjXzQQ0mu n0bUpGWIduItyZgtcQ5VmcgWAcARlx0Hg/g0O7d6d2ppwwSmxbbjWKyFdj7f/fGs/Zd/rq EZkU4+bPz3eXAirDyCDqO3rJdqh4R0h9Z/gIazrqG+JD+Vfq3TH8jUK+4TzlOA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668470512; a=rsa-sha256; cv=none; b=iz9H01hHIoJDrzkO2osi0YdU4KTl5z78eoEFA4+71Yb3dIBlmpVdt0ysiANrB/Zi8ssbSp 4RQ2MWTBGi9VpxDmv8RZmdgMRTOb8rfMjMsRiyPZMkPAPVnvS1p1y5osj4+CGroj4YMxgX 1f5bpejooXrapiNltNc816BpMZeH44SAuk8E/opwJ13Z0c2cwf0vrDMFek2hqVEJ/GQrzm DkkryTTL4mvyJmtIGBgx/10fzZC4wmSUfj6IroK0sNG6qL81Q3rTGTOKP0RgDN4w5Y9GjQ FmyjojfUfFQm4F9U6T53dh0hfZEj9SU3aNXbcQOGjTqS8+H4CZtAU9o7sENysw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=iixn16A5; 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: -8.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=iixn16A5; 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: 0774738EE1 X-Spam-Score: -8.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: 387pagrfcQtU Max Nikulin writes: >> 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. > > Depending of particular capture template (even with :immediate-finish t) > empty selection may or may not be an error. In Samuel's case it is an > error. Unfortunately, while the template is processed, signaled errors > are caught and their text is inserted into the text. That is why in my > example I put checks outside of `org-capture'. Are you sure? `org-get-x-clipboard' returns nil in case of error and `org-capture-fill-template' assigns empty string to v-x when no clipboard value can be obtained. > We may: > - Add a capture template option that allows errors to pass through to > the caller. Then a user may add %(...) expression with all necessary checks. I am not very sure what kind of errors you are talking about. AFAIU, we are talking about scenarios when user explicitly wants one of PRIMARY/CLIPBOARD/SECONDARY, don't we? >>> 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? > > It will work for most of users, however sometimes it is incorrect. There > are a number of options that should have higher priority than emacs > server DISPLAY environment > - emacsclient -display command line option, > - emacsclient process DISPLAY environment, > - emacs -display server argument. > > I have no idea how to get "emacs -display" argument and I need to look > into emacsclient source and server.el to figure out which way client's > display argument is passed to the server process. Maybe it can be considered an Emacs bug or something to improve on Emacs side? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at