emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Max Mikhanosha <max.mikhanosha@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: BUG+PATCH org-capture hangs under Cygwin/X
Date: Sun, 31 Jul 2022 20:45:53 +0800	[thread overview]
Message-ID: <87r121labi.fsf@localhost> (raw)
In-Reply-To: <CAGAC3hC5mq2PB4aZG9P0-sZD7cG4RnETfwTai7wnzpDbCM8vFQ@mail.gmail.com>

Max Mikhanosha <max.mikhanosha@gmail.com> writes:

> Due to various reasons I'm now using Cygwin/X Emacs, and for this emacs,
> (gui-get-selection) method is kind of slow (about 0.2) seconds.
> ...
> Attached patch changes it so that we only call (org-get-x-clipboard) and
> (current-kill 0) lazily. The logic had not changed, we just don't pre-cache
> values that we don't need.

Thanks for your contribution!

The idea looks reasonable.
However, I am unable to apply the patch onto current main branch. Please
consult https://orgmode.org/worg/org-contribute.html#first-patch

> Subject: [PATCH]   org-capture: fix hang under Cygwin/X emacs.
>   * org-capture.el (org-capture-fill-template): change it so that
>   (current-kill 0) and (org-get-x-selection) are called only lazily on
>   as needed basis, and their results are cached.
>   This reduces worst case of calling (gui-get-selection) from 28 times
>   to 12 (worst case being both clipboard and selection being empty)
>   and in the best case of there being no %x %c or %^C template
>   arguments there will be zero calls

Please follow the formatting conventions for the commit messages as
described in
In particular, pay attention to the space between sentences, ending
sentences with a full stop, and quoting the Elisp `symbols'.
The same applies for comments in code.

> +         ;; On Cygwin/X org-get-x-clipboard is extremely slow
> +         ;; therefore use lazy evaluation for calling x-org-get-clipboard

For example, `org-get-x-clipboard' should be quoted, and the comment
should end with ".".

> +         (x-clip-cache (list (list 'PRIMARY nil nil)
> +                             (list 'CLIPBOARD nil nil)
> +                             (list 'SECONDARY nil nil)))

A more compact form is

(x-clip-cache `((PRIMARY nil nil) (CLIPBOARD nil nil) (SECONDARY nil nil))


      reply	other threads:[~2022-07-31 12:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12  3:44 BUG+PATCH org-capture hangs under Cygwin/X Max Mikhanosha
2022-07-31 12:45 ` Ihor Radchenko [this message]

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:

  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=87r121labi.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=max.mikhanosha@gmail.com \


* 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


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).