From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id wazLFg4BoGT0PAAASxT56A (envelope-from ) for ; Sat, 01 Jul 2023 12:33:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 0I4nFQ4BoGQZUQEAG6o9tA (envelope-from ) for ; Sat, 01 Jul 2023 12:33:50 +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 C1D1A4CDE for ; Sat, 1 Jul 2023 12:33:49 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFXuu-0005CV-21; Sat, 01 Jul 2023 06:33:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFXuq-00059z-5s for emacs-orgmode@gnu.org; Sat, 01 Jul 2023 06:33:20 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFXuo-00062p-E8 for emacs-orgmode@gnu.org; Sat, 01 Jul 2023 06:33:19 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-666e6541c98so2254094b3a.2 for ; Sat, 01 Jul 2023 03:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688207595; x=1690799595; h=mime-version:in-reply-to:reply-to:date:subject:cc:to:from :user-agent:references:message-id:from:to:cc:subject:date:message-id :reply-to; bh=JiIncdzyR+j197HrdFE5T6hxX/2CRAD+MvqV6kikWVc=; b=Lt93Qnw6GC98oitUzGkLg6BqCwOD9qWnojX8CZ/nUshjrouaosk56irTAtxg9l96fC RJc6kPlKTuvzZTY4tWOgyo27f6BwIltJDHkvSUDOzPHU+jfRMEy3PiBnGH2GZPV3qqRe oLN8sc+B7IPqAG+2wukTGe2hFZqWhC0k23u+usHgV1rUW3zVcRmWhDJswxc55Vdpr+m4 blxesJwV32KCzeTq6I4PE5Oqu+rh/N2vp5Oh+DOAkE0+dE0lBl/M6fudbTud1sKiMie/ TZCObc+XtAnJdXPk7us1GFPplQfIpaAMd6MHdQUXotc4bHmAfCK8ofIeLLezzVL+nAVh dkpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688207595; x=1690799595; h=mime-version:in-reply-to:reply-to:date:subject:cc:to:from :user-agent:references:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JiIncdzyR+j197HrdFE5T6hxX/2CRAD+MvqV6kikWVc=; b=fa8n9fzdbG9V653EcLgMGyO0TBv67yymew9pDnAzGXtEcVanOikXU0poWYxBEz1sQQ 2jn3fJuGTNzpqNcQ6Do6785yHTg9bqqq7g05+aHRr6cUhLpu3xAVoi0XVe/YXZKycKlu jN2u0hPlxalsrkDAh+WD4ERLXUFv2g8rWsVW7rcY2ZLbeQGXHywhV/kSNGTMGWyjoR6I P+dxOtgiFDIG0Io2t/VNxwmCHJz+zNduXp6pp1NA1Sr3tMoTmH3iBagUO+r0ygRVz5QV A2pounpZMVtkjVXLlQZlUL+v1F5hXQGv84uSZqzLhIINEpYEqWYtwxpFuBx3AQ//NiYj wVBQ== X-Gm-Message-State: ABy/qLYRqJ1xCaG4FwpOxcmjriG2HiusnYSy4RlRSOsdOnemWAug17yA 0oLzxRfzhJhPc1YgHyTztQ== X-Google-Smtp-Source: APBJJlHvpW+c6kqz5fIMRhROtsQ95aM32DffaVECTF8hEysMWVr6vgTLzfhyZw8rX3lnOS0Emh7RhA== X-Received: by 2002:a05:6a20:3c8f:b0:12a:cc8:75d5 with SMTP id b15-20020a056a203c8f00b0012a0cc875d5mr6247091pzj.50.1688207595250; Sat, 01 Jul 2023 03:33:15 -0700 (PDT) Received: from Mac-mini.local ([223.95.24.139]) by smtp.gmail.com with ESMTPSA id k3-20020a170902694300b001a24cded097sm12041725plt.236.2023.07.01.03.33.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 01 Jul 2023 03:33:14 -0700 (PDT) Message-ID: <64a000ea.170a0220.250a9.7355@mx.google.com> X-Google-Original-Message-ID: Received: by Mac-mini.local (Postfix, from userid 501) id 2F6EE98DCE96; Sat, 1 Jul 2023 18:33:09 +0800 (CST) References: <878rds1xta.fsf@localhost> <87a5y8iiak.fsf@localhost> <645fc094.170a0220.4d545.38e1@mx.google.com> <87wn1cgjij.fsf@localhost> <64604168.170a0220.99926.5b4f@mx.google.com> <87lehrgwqn.fsf@localhost> <6460f5e3.630a0220.b9085.17d2@mx.google.com> <87ilcvdknx.fsf@localhost> <64611586.a70a0220.53db4.4151@mx.google.com> <871qjiiziz.fsf@localhost> <64612e34.170a0220.28faa.5dcb@mx.google.com> <87v8gthnc9.fsf@localhost> <64624762.170a0220.fd372.5c0d@mx.google.com> <64625a39.620a0220.e2d74.706d@mx.google.com> <87v8gs4o88.fsf@localhost> <646375bd.170a0220.b1c70.dbf1@mx.google.com> <87o7mk3y72.fsf@localhost> <64646d12.170a0220.b780c.b216@mx.google.com> <87sfa9p0sy.fsf@localhost> User-agent: mu4e 1.11.6; emacs 30.0.50 From: "Christopher M. Miles" To: Ihor Radchenko Cc: "Christopher M. Miles" , Org-mode Subject: [PATCH v5] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist` Date: Sat, 01 Jul 2023 18:31:30 +0800 In-reply-to: <87sfa9p0sy.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=numbchild@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, MSGID_FROM_MTA_HEADER=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: , Reply-To: numbchild@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688207629; a=rsa-sha256; cv=none; b=JzKll/pLUrmK5qfQXHpuGFz3HGkFdbGJFwjHEnVTasiD8JjRblPjGQoRaQfBQJzvp4UppU K4Mw9SKC00SpXdt4QdFb1awJrfz3d6SkAm/xikqSyLaIhJ1MXherB/w+4aIoRuOmSo/OkR XPFjwi418Ay20E7BK6QpIJol13hc4mDawfRR4CToOocGZBN9hPVqV74xkBpt+p/J6I1eD8 hQBbKLD+uuZoqWzjfE2YV9UiUB4XEohQDgk8b8Ru3wjhY9DXoTlNFBoMNmu2ujJSBN/mCn npuaMG0jAC2nc//7gltXHaowaFWj8+5+W15hnSrQ3nGftMRIxyZP4j30twth0A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Lt93Qnw6; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688207629; h=from:from:sender:sender:reply-to: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=JiIncdzyR+j197HrdFE5T6hxX/2CRAD+MvqV6kikWVc=; b=Jo5Da+qsZ0ykUPHgMwsiWmj+7w9J6lvKgIOCF+PxUr0FRcNA/+2Q0HMXHBcE8iPEvainKH PmhuRVelChvt4s0B69OMWB1gk8hIvhEPdmaRDAjOc3SbsQlJ3hrCMQ7oP5CimqguneQU9u 0J05kv3db3LeUGPyBNw1vNzX5di0E7WhoQtdnLyWIKeu3dV6Pfmfr9saZUC8M/qO96MGvh ysexJJBa2lHxScJDEzB/X3gnm4H9GHB2gHA4gMfj/u0G1lQs7gPyK00T3SaM4VLlJqp+ka 2SJSISh75S3swXMz0RSAQn2Pem3Yn5lryifJSpNSybXfeuoqz51UwgsM3QaLjA== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Lt93Qnw6; 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-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -11.92 X-Spam-Score: -11.92 X-Migadu-Queue-Id: C1D1A4CDE X-TUID: sliUJ/Vj4TEy --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> I improved the code a little. Can't figure out how to implement upper logic. >> Can you finish the last part? Thanks >> >> #+begin_src emacs-lisp >> (setq tbl (let* ((tags-grouped (org-tag-alist-to-groups fulltable)) >>... > > I tried to improve the code readability in `org-fast-tag-selection'. > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a19654583c6f2070096402bc712591a0a2c80d01 > > May you look at it again and see if you can manage to implement a full > patch now? Ok, I update and re-generated the patch, also add new document and Org NEWS entries. Review it, if has problem, notify me to modify. Thanks --=-=-= Content-Type: #("text/x-patch" 0 12 (prescient-regexps nil prescient-ignore-case t)) Content-Disposition: attachment; filename=0001-org-Improve-the-tags-fast-selection-performance.patch Content-Transfer-Encoding: quoted-printable From=2077fdbf8552a0a2ff451bf9071f6646ac016cb262 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Sat, 1 Jul 2023 18:29:02 +0800 Subject: [PATCH] org: Improve the tags fast selection performance * lisp/org.el (org-fast-tag-selection): Filter out only maximum number limited tags has fast selection bound when `org-use-fast-tag-selection' is 'auto and tags has fast select bound keys. * lisp/org.el (org-fast-tag-selection-maximum-tags): Add new custom option to set maximum tags number for fast tag selection. * doc/org-manual.org (org-fast-tag-selection-maximum-tags): Add new custom option document. * etc/ORG-NEWS: declare this new custom option. =2D-- doc/org-manual.org | 10 ++++++++++ etc/ORG-NEWS | 11 +++++++++++ lisp/org.el | 14 +++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 3a49917d7..30fcf32dc 100644 =2D-- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -5073,6 +5073,16 @@ effect: start selection with {{{kbd(C-c C-c C-c)}}} = instead of the special window is not even shown for single-key tag selection, it comes up only when you press an extra {{{kbd(C-c)}}}. =20 +#+vindex: org-fast-tag-selection-maximum-tags +Limit the tags table when you have many tags. You can set the maximum +tags number for fast tag selection interface. When the variable +~org-use-fast-tag-selection~ is ~auto~ and +~org-fast-tag-selection-maximum-tags~ variable value number is smaller +than single key bound tags number, the fast tag selection will only +show single key bound tags, in contrary, will show the maximum number +limited tags. If ~org-use-fast-tag-selection~ is other values, will +show full tags. + ** Tag Hierarchy :PROPERTIES: :DESCRIPTION: Create a hierarchy of tags. diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index cb4bc632b..dfabbfbed 100644 =2D-- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -322,6 +322,17 @@ special repeaters ~++~ and ~.+~ are skipped. A capture template can target ~(here)~ which is the equivalent of invoking a capture template with a zero prefix. =20 +*** Add new option ~org-fast-tag-selection-maximum-tags~ to limit fast tag= selection interface displayed tags + +Limit the tags table when you have many tags. You can set the maximum +tags number for fast tag selection interface. When the variable +~org-use-fast-tag-selection~ is ~auto~ and +~org-fast-tag-selection-maximum-tags~ variable value number is smaller +than single key bound tags number, the fast tag selection will only +show single key bound tags, in contrary, will show the maximum number +limited tags. If ~org-use-fast-tag-selection~ is other values, will +show full tags. + ** Miscellaneous *** =3Dorg-crypt.el=3D now applies initial visibility settings to decrypte= d entries =20 diff --git a/lisp/org.el b/lisp/org.el index fdb920864..f077cde12 100644 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -2775,6 +2775,12 @@ displaying the tags menu is not even shown, until yo= u press `C-c' again." (const :tag "Yes" t) (const :tag "Expert" expert))) =20 +(defcustom org-fast-tag-selection-maximum-tags 26 + "Set the maximum tags number for fast tag selection." + :group 'org-tags + :type 'number + :safe #'numberp) + (defvar org-fast-tag-selection-include-todo nil "Non-nil means fast tags selection interface will also offer TODO states. This is an undocumented feature, you should not rely on it.") @@ -11929,7 +11935,13 @@ these have keys assigned to them. If the keys are nil, a-z are automatically assigned. Returns the new tags string, or nil to not change the current settings." (let* (;; Combined alist of all the tags and todo keywords. =2D (tag-alist (append tag-table todo-table)) + (tag-alist (let* ((tags-table (append tag-table todo-table)) + (binding-tags (seq-filter 'cdr tags-table))) + (cl-case org-use-fast-tag-selection + (auto (if (length> binding-tags org-fast-tag-selec= tion-maximum-tags) + binding-tags + (seq-take tags-table org-fast-tag-selectio= n-maximum-tags))) + (t tags-table)))) ;; Max width occupied by a single tag record in the completion bu= ffer. (field-width (+ 3 ; keep space for "[c]" binding. =2D-=20 2.39.2 (Apple Git-143) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express without mi= sunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmSgAOEACgkQG13xyVro msOZ2wf/XTq3Uybu4O9g4RXm3n9L+9pv4u/Zkfi5bFKgOtyengLLJxVNXhUhsnhy F47gt6wweFoiXsPBqrdKNBPj5vOvywcOcXBCwj1oqTm9GYYIZHRwSXjVEZwFEBEI aHy1+13oY1S0vDet11uXqiXp2L8OpeD5aRpc8cu0TLdfmRSXgWPWkzmS9LYYRx84 +7VcK++qBITO0YixQLk4ZAhUb0VcFSasMWiKLuNC3fO6RrJjH7vGIZLOK3g+jq6V C0iTJISEBCoSzat8Up2Rm4hu2rwiNcQmvQfipjMOZQ6ISlRlz4Lu08g+/eHcxj4D tWtKQf5e+L9v5UmVEAYm0U2Mva8RcQ== =GaWi -----END PGP SIGNATURE----- --==-=-=--