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: Samuel Wales
Subject: Re: Getting X selection reliably (Re: idea for capture anywhere in x)
Date: Tue, 15 Nov 2022 21:03:56 -0700

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


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



reply via email to

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