emacs-orgmode
[Top][All Lists]
Advanced

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

Re: BUG+PATCH org-capture hangs under Cygwin/X


From: Ihor Radchenko
Subject: Re: BUG+PATCH org-capture hangs under Cygwin/X
Date: Sun, 31 Jul 2022 20:45:53 +0800

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
https://orgmode.org/worg/org-contribute.html#commit-messages
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))

Best,
Ihor



reply via email to

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