From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MJPcGZh55mKCbQEAbAwnHQ (envelope-from ) for ; Sun, 31 Jul 2022 14:46:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id MG/iGZh55mLF3wAA9RJhRA (envelope-from ) for ; Sun, 31 Jul 2022 14:46:16 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1BA0D35DED for ; Sun, 31 Jul 2022 14:46:16 +0200 (CEST) Received: from localhost ([::1]:44318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oI8Kk-0007gB-Uh for larch@yhetil.org; Sun, 31 Jul 2022 08:46:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oI8JP-0007c1-MK for emacs-orgmode@gnu.org; Sun, 31 Jul 2022 08:44:51 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:45982) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oI8JN-0001uP-VY for emacs-orgmode@gnu.org; Sun, 31 Jul 2022 08:44:51 -0400 Received: by mail-pj1-x1033.google.com with SMTP id p14-20020a17090a74ce00b001f4d04492faso3127500pjl.4 for ; Sun, 31 Jul 2022 05:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=QDEkfo0BTuH96/72/qBrQlWr47IUKSojHLMERvEBpqc=; b=htNQox6QJ0FbRV4LpB0Ro12u0Iv9J5mcxmfN0lyuUtfUB2Ve8n5URkcW+ET8iQdhUc LLPQtx0ozlIbW5Phz2MJ7x5n4z93MhqGsCh8Y/1JetcftlxeYpFBiNg91AE/PkjcmUV2 VGxdyqIrNC3OXQQ6SJUelX8d0fMiMAa2Bn366PSzqxLM3HcnJZkszpqUJbXSG1SqiFK2 2tHLKpZxwHjKTz60xBf9CwuhpnkUVA/owkTmGtU0+LtYX1Sz4V9KRrF3ubPy2V20dMtH d3GMsee9eA7KFESuIOFH1g77uVo2FyzZA3ItFJBZrWTYcPmwYmBZvjqPR2o6NTR7KBQh 0O3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=QDEkfo0BTuH96/72/qBrQlWr47IUKSojHLMERvEBpqc=; b=TBFRs56+l9VuI3ro7eFGkZ9PvfeegGGaeEhlTS/GOq5pEy6yAIXqnCQOjBH3STlc/0 oA8XrsoMurSaBeK/pjsIgGu5FDdTwF2WMq3z4GVH5480Np4K669V3ylqbG85u/6YMGH+ TnJPD1NrJbWswd9iJ4tRacLEPd/MH6F/ReG8QEy22zeP6PPSw0tFCEIB2gh0ZO4Y7qcw SkeVIjJUyMqGYzngd2QixM+rV4YX+vgP1SrgzbPHh9gDZELVO1uTWU5hXyrTdStVw6tK oe9S41/DKgtU4mPYiEAAQb1q1eKiQrdGHIhIZa06Dr1c+cw8S1iHJEoblNDDVhcMozAZ 1nGQ== X-Gm-Message-State: ACgBeo2d+XDf07xuqgLRRzEb2Lua14uhIrjKPmiYCjGQnEO4dhNjRvTI OoQQTwrzHsmeC4UR6la/y3w= X-Google-Smtp-Source: AA6agR4ZNB0wbNk5pk2Eh8wuDfaqU21yHlBzNIUS7W2L38XbgKd4rrBGR3ewW8OnAqi5fYJ3sgjhXA== X-Received: by 2002:a17:902:dac9:b0:16d:5cfc:6fb7 with SMTP id q9-20020a170902dac900b0016d5cfc6fb7mr12521385plx.64.1659271488310; Sun, 31 Jul 2022 05:44:48 -0700 (PDT) Received: from localhost ([2409:8a70:217:4f80:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id d12-20020a170903230c00b0016dc1df9bf7sm7454200plh.27.2022.07.31.05.44.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jul 2022 05:44:47 -0700 (PDT) From: Ihor Radchenko To: Max Mikhanosha Cc: emacs-orgmode@gnu.org Subject: Re: BUG+PATCH org-capture hangs under Cygwin/X In-Reply-To: References: Date: Sun, 31 Jul 2022 20:45:53 +0800 Message-ID: <87r121labi.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659271576; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=QDEkfo0BTuH96/72/qBrQlWr47IUKSojHLMERvEBpqc=; b=fRVkFa4Bib7TICkXjMEUdaFJX17h53wZ9vItjUCmebNnzulsTv/IwGi3RvynRLo5+OVQvw OO/R1qTZUNCIwp+dA1TGARgFlQwasOUP5zqRp+AHFXfQuGZ9K1b+b47EPh1B7bv/q0v732 ujwStff1LlAdtswLEMMULnLQDFDF5s6y7Hy8VDmpSkAFVMXBH5Se5RzlztDw/dh8J6/Lkb a4USMOszdpIttUQy3376UxmNmDKLj7fTZY8QJOHvxOR/wDMfGeoyzT+naG5fT5h0e1AdP6 j3w0TUHVPbGsYegTyIu5Sm9XIfLDzBEjQq8LC/rHF37fE23CTzs4WKjmiNY9Lg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659271576; a=rsa-sha256; cv=none; b=KWCQGV8yF4FWoqPkijf8QzcHkUVq/Kl85UgLuiPK25ocMTitCj6vwDF7YkQSW/lhsMremm 6V/M2p2v/5yDuJinFUYh5u8ZrH3lL+AK/VQrBJ4T4fIFO3Id81v/RZF5AsxT8DplAfo53+ Wz1/nAp/O+I4U0YzT2WuoKHNW+o1fjOHfMw3uNrSWUVmd/PdweSUuE1IiPpOmW3T8P8rhz XNOmgBQRO6UYwgZBd8k5frE+JjbhnalHDQQlRxDdmyUcCrAv6xb+BpSiwj1wXhAdGhCCq6 PGdpTP4YXYK9Kg96wKRwSj5qeJoB5CkViwzJV49lEE9Uib+Q7dSG25EdIewoLg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=htNQox6Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.42 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=htNQox6Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1BA0D35DED X-Spam-Score: -5.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: aoQxJ8OxWUlv Max Mikhanosha 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