emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Max Nikulin <manikulin@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Getting X selection reliably (Re: idea for capture anywhere in x)
Date: Tue, 15 Nov 2022 21:03:56 -0700	[thread overview]
Message-ID: <CAJcAo8v7KyxUYqchpa+3nEups4zy9hda7XmbuzR9qV1RpSKcTQ@mail.gmail.com> (raw)
In-Reply-To: <877czyguhp.fsf@localhost>

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	other threads:[~2022-11-16  4:05 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08  4:22 idea for capture anywhere in x Samuel Wales
2020-09-08  5:01 ` Tim Cross
2020-09-08  5:05   ` Samuel Wales
2020-09-08  5:21     ` Tim Cross
2020-09-08  7:18       ` Maxim Nikulin
2020-09-08  8:03         ` Diego Zamboni
2020-09-08 16:08           ` Maxim Nikulin
2020-09-08  5:39     ` Maxim Nikulin
2020-09-08 22:40       ` Samuel Wales
2020-09-09  4:52         ` Maxim Nikulin
2020-09-10 14:23           ` Maxim Nikulin
2020-09-12  8:48             ` Nick Econopouly
2022-06-10  2:35               ` Samuel Wales
2022-06-10  9:59                 ` Charles Philip Chan
2022-06-11  4:11                 ` Ihor Radchenko
2022-06-13  7:46                 ` Max Nikulin
2022-06-13  9:10                 ` Michal Politowski
2022-06-13 10:04                   ` Max Nikulin
2022-06-13 14:02                     ` Michal Politowski
2022-10-12  1:09                       ` Samuel Wales
2022-10-09 14:47                 ` Jean Louis
2022-10-09 16:40                   ` Max Nikulin
2022-10-09 17:08                     ` Jean Louis
2022-10-10 17:16                       ` Max Nikulin
2022-10-10 22:06                         ` Jean Louis
2022-10-11  9:11                           ` Juan Manuel Macías
2022-10-12  1:09                             ` Samuel Wales
2022-10-15  3:40                               ` Max Nikulin
2022-10-26  4:40                                 ` Samuel Wales
2022-10-26  4:58                                   ` Ihor Radchenko
2022-10-26  5:05                                     ` Samuel Wales
2022-10-26  6:05                                       ` desktop notifications (Re: idea for capture anywhere in x) Max Nikulin
2022-10-26  6:22                                         ` Samuel Wales
2022-10-26  7:41                                           ` Max Nikulin
2022-10-26  8:07                                             ` Samuel Wales
2022-10-26  8:29                                               ` Max Nikulin
2022-10-27  6:33                                     ` Getting X selection reliably " Max Nikulin
2022-10-28  4:59                                       ` Samuel Wales
2022-10-28  5:16                                         ` Max Nikulin
2022-10-28  8:39                                           ` Dr. Arne Babenhauserheide
2022-10-28 16:38                                             ` Max Nikulin
2022-10-28 23:07                                               ` Samuel Wales
2022-10-29  3:21                                                 ` Max Nikulin
2022-10-29  2:59                                           ` Ihor Radchenko
2022-10-29  3:30                                             ` Max Nikulin
2022-10-29  6:03                                               ` Samuel Wales
2022-10-29  7:33                                                 ` Max Nikulin
2022-10-29 22:33                                                 ` Samuel Wales
2022-10-29  4:50                                             ` Samuel Wales
2022-10-29  4:59                                               ` Ihor Radchenko
2022-10-29  7:44                                                 ` desktop notifications " Max Nikulin
2022-10-29 23:07                                                   ` Samuel Wales
2022-10-30  4:49                                                     ` Ihor Radchenko
2022-11-13  4:54                                       ` Getting X selection reliably " Ihor Radchenko
2022-11-13 11:03                                         ` Max Nikulin
2022-11-14  2:06                                           ` Ihor Radchenko
2022-11-16  4:03                                             ` Samuel Wales [this message]
2022-11-16 16:46                                               ` Debugging firefox extension " Max Nikulin
2022-11-17  3:16                                                 ` Samuel Wales
2022-11-17  9:42                                                   ` Jean Louis
2022-11-17 16:12                                                   ` Max Nikulin
2022-11-17  7:18                                               ` Getting X selection reliably " Jean Louis
2022-11-17 15:30                                                 ` Reliability of org-protocol browser extensions Max Nikulin
2022-12-04  5:21                                             ` Getting X selection reliably (Re: idea for capture anywhere in x) Max Nikulin
2022-10-12 17:16                           ` idea for capture anywhere in x Max Nikulin
2022-10-12 20:06                             ` Jean Louis
2020-09-09  8:40     ` Russell Adams
2020-09-09 21:11       ` Samuel Wales
2020-09-09  1:07 ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJcAo8v7KyxUYqchpa+3nEups4zy9hda7XmbuzR9qV1RpSKcTQ@mail.gmail.com \
    --to=samologist@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).