From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 gNS8G3ZhdGPvyAAAbAwnHQ (envelope-from ) for ; Wed, 16 Nov 2022 05:05:10 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IPy4G3ZhdGOvGQAAauVa8A (envelope-from ) for ; Wed, 16 Nov 2022 05:05:10 +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 0453D2828D for ; Wed, 16 Nov 2022 05:05:10 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ov9eh-0005ca-Ht; Tue, 15 Nov 2022 23:04:07 -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 1ov9ee-0005cB-TW for emacs-orgmode@gnu.org; Tue, 15 Nov 2022 23:04:05 -0500 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ov9ea-0003Cg-PW for emacs-orgmode@gnu.org; Tue, 15 Nov 2022 23:04:04 -0500 Received: by mail-lj1-x229.google.com with SMTP id z24so20253395ljn.4 for ; Tue, 15 Nov 2022 20:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2lyjqO3iG5BgkpUZfr06VoQNCT5ZSRrL5ElDOq5hExQ=; b=eE0Ujs2RBrxPFq3dDe0tYEdpnW3gznUMlAqA/P3yZ+eeHqkJR4Px7MuVarS1z7Qfg7 1p8aNjgoiLnG9WlRrN8En+laURTfbMHao6Vk9LwfmP3KQEM5gErPXb74haTs75EePRgF 5V87fSLBhz0gvoauqaQZjBbHjMm+l7T3VmraoF8roKGR/mz/UvSJuKkTzx16If+kFDS7 a4OveJI3vWT5yCSPMvEBfCMHPXYzkoyIhOF5F0RZw0uhuWZAWuLXAmBSodSlRMjh6SRb gqTa+zg6yqgEhruhWMUO1JCcD0OmyNI3WmGr/H4wIQ9EzGTN3C61+iYVEX2rwsueoLZG WVkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2lyjqO3iG5BgkpUZfr06VoQNCT5ZSRrL5ElDOq5hExQ=; b=bjWiwmbTTB+uThGCa+6oWT1iA+44Cy4UOn8PF6zOLmDtnLENVxYKiVN1L4zRhhWg3Z WvDvseSlBrpBmiLVHlRd197JDtOtZnuQ7gqFbg6wW9Nlbrp4AtCjLWv68YpufLMs0RsZ YphbleK3DvmMsk+f1FRjcM965ilL2lWMAHT7hF38vgazSuTnscd0wyHmrnI54hEpilh8 sZd4pxuKCWcHLVnrcd9hyooZP8YoZdg46RHnz27Flf9WLoREdIpkoPtbE6kJ98hSRJKh F1Yfpl5FYRMeKaacOwUtunU1RlBSy8mlAbVrtM6Kwtwuc69urqcyxzZYHthpjp2lBdtd WrmQ== X-Gm-Message-State: ANoB5pk20sZivGgOLJPsx48wonwoVYFBCg6OEenAKDv/4dURhqUzZz1x ari0dDTDjUvrrSqx13BPKedOhl+Dmsl2KTONvy8= X-Google-Smtp-Source: AA0mqf4UuwoCvWivfDvgPr0p9a7766Vl1Mn5BRqUAbdkEtPCRtjxkGHd3PWDZCibklGeGgrSWEMp68hWcDQa6dWay1U= X-Received: by 2002:a05:651c:1252:b0:26f:db16:4735 with SMTP id h18-20020a05651c125200b0026fdb164735mr7152725ljh.323.1668571438049; Tue, 15 Nov 2022 20:03:58 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a05:6520:4af1:b0:22a:e96a:7f9b with HTTP; Tue, 15 Nov 2022 20:03:56 -0800 (PST) In-Reply-To: <877czyguhp.fsf@localhost> References: <87tuw31iub.fsf@mm.st> <87r0zelo7e.fsf@posteo.net> <875yg7qiyb.fsf@localhost> <875yfj8nf7.fsf@localhost> <877czyguhp.fsf@localhost> From: Samuel Wales Date: Tue, 15 Nov 2022 21:03:56 -0700 Message-ID: Subject: Re: Getting X selection reliably (Re: idea for capture anywhere in x) To: Ihor Radchenko Cc: Max Nikulin , emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=samologist@gmail.com; helo=mail-lj1-x229.google.com 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, FREEMAIL_FROM=0.001, 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=1668571510; 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=2lyjqO3iG5BgkpUZfr06VoQNCT5ZSRrL5ElDOq5hExQ=; b=Nkb4RZOBWm1MJ/TOaYP5oyb+16eF+8Uf4nvfPkS/TJ5rePKB5WxVyzjl0nXiPvypmZXzf7 ZzBqMLJj4aDilTQPgY6wAJu3eCBup7EKnp1b+r18vkvKabkHBtvOrE8LzWkKOINUruA3Cp YbaArLnvr8RzOMNPdIetLCFxZF9CiIIuQBXqRUtLqM6u1w7mE8RG/2f1XLr0vgTgT5FLx4 PKmdKnBB/PuFw9T0NW50jf2m9Jyb79B9UnK38NQzXXvyzz5bt9uE5Qg7XfGtek/uVXstVe lD6q/8L6alXt+Am7DnV+rFRWVSQ1N51MgPaG8zP1zPhpYYImJB18Bz9mrs9x9g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668571510; a=rsa-sha256; cv=none; b=ArvYXKlchEuin+nxtkmePtHkmbVU6d5fgNSEIjyMxy9HsBo42/iQDVt0lCu2dtCPQA/hof 1Tt9X028orMAsoRjqgiJZlk6NlJKYvDht+EyZ2/+HmUAp4we8syeLdeY6N5icS3ef2vwcM 2fgj6A9EABX6+CpvFS6HcQzFfZ6etV4uk+zgKOfco22CsabpByrvsh0QumsJ5vZUZPP43X NUNbTwjEZ6yDzn8jGsBPDcFhXuJZLYaeDe9JjrKfOWuhuWbAq/m/LL/AD0Xkz84Jelrm2i mdcSLSihw9x4LkXZlv3Y1YraMkTKh49+P8E7S1aNlytob4noGJMC18FRAWhaVw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=eE0Ujs2R; dmarc=pass (policy=none) header.from=gmail.com; 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.54 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=eE0Ujs2R; dmarc=pass (policy=none) header.from=gmail.com; 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: 0453D2828D X-Spam-Score: -7.54 X-Migadu-Scanner: scn0.migadu.com X-TUID: 8tQ80yNE+fKL idk if related to this thread, but i sure do appreciate the effor in this thread to solve such problems. it is a key feature for me because i am often in mouse-only mode. it is thus a constant concern that org-capture could stop working etc. right now, it seems org-capture is broken for me again. clicking on unicorn results in the momentary captured indication in huge text on the screen [i like this indicator], but it does not get captured to my org capture target. this is with or without selecting any text. could a kind soul remind me how to debug this again? i have made no changes to my capture template or code in a very long time. i don't think firefox-esr has updated recently. On 11/13/22, Ihor Radchenko wrote: > 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 > > -- The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com