emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting X selection reliably (Re: idea for capture anywhere in x)


From: Ihor Radchenko
Subject: Re: Getting X selection reliably (Re: idea for capture anywhere in x)
Date: Sun, 13 Nov 2022 04:54:04 +0000

Max Nikulin <manikulin@gmail.com> 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 <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]