From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id IOQiC3cuYWTHgAAASxT56A (envelope-from ) for ; Sun, 14 May 2023 20:54:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aH8cC3cuYWSI8AAAauVa8A (envelope-from ) for ; Sun, 14 May 2023 20:54:47 +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 8CACE2E9E6 for ; Sun, 14 May 2023 20:54:46 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyGqp-0001Je-G0; Sun, 14 May 2023 14:53:47 -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 1pyGqo-0001JW-Kr for emacs-orgmode@gnu.org; Sun, 14 May 2023 14:53:46 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pyGqn-00023I-4U for emacs-orgmode@gnu.org; Sun, 14 May 2023 14:53:46 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1ab01bf474aso90299735ad.1 for ; Sun, 14 May 2023 11:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684090423; x=1686682423; 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=HPYe9BgVSuj1VillW5V/YOqWEldck2i2CvV4PXMl7uA=; b=cfch6eygBe5/FA9l2vLxyMcs+zWeB+0QHqto99HR8CBUPe+6/GQqox4LT1cE1rOWeE mxlxF9Lh6LQyvH6SukZo0pIXvgnoP4uuW/wj3YAhyKJbQdzoRnkJK182cP7JIkl4a+bR qMj+qR9snrA/4PXADqLC9Era/sIOwzDxPPpyeMzTNbj7WgMFbBVel1bYulQb1QiqhqY9 JDDR3CPQJuDtM2XdphCLIRxsB7ie8LrPS3BJEFoQ8HSRe/4ZrB0nzwtTT5WVAx6P1n0z g7spHiu5xoPclBztxl0/GRM+EgmuBQHZzAGQEUFFmiFFMbdRr3qmw7mq7iHurfBKRyI1 JXVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684090423; x=1686682423; 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=HPYe9BgVSuj1VillW5V/YOqWEldck2i2CvV4PXMl7uA=; b=UibSY4/4J25uXINWq+/M3wrcbkVqVEP8dbe2LXUamlNwVFEP/2I531MZlbZJ0j9V2V oX2lMQDymIQ/TZWizrwFEQ2kpQrnd3rNkAhlhzGLZHahymNP7dvcga0ppqd4opq3wt/V L/xTGk1oujsCIxiUNzodO09CNlbIRbAh5+gOuNcifdasvVQAmEpi+53hE3RHH4xGBwXX ztXF6ZfWw3ghIohfan/ORHNM7sC+ShE4z/4ntChJw/yEyOslOlcxR9l7v4gSJ/3l69+n XADsee/4PYgv5KIJl+iJkrN5EBChjkJSPD3itqfm+gUmBMizuGRZ6iCQ97ejw9EkCtxZ AewA== X-Gm-Message-State: AC+VfDx2HrGErqqyC4Yd5FXYp8DeYvnGyWaGa1HQ01yh1ZIz20MtH7V0 MhbxW6ssYQhzaPqZmO0Xbg== X-Google-Smtp-Source: ACHHUZ6uza4jEWWM0ziEEdWDvoMsicpT+uqSg+DyRdJR2gvXiw+60b2qEt+jXTdFwQVnV87GP/ABhw== X-Received: by 2002:a17:902:ba86:b0:1a6:bd5c:649d with SMTP id k6-20020a170902ba8600b001a6bd5c649dmr29848912pls.56.1684090423336; Sun, 14 May 2023 11:53:43 -0700 (PDT) Received: from Mac-mini.local ([39.171.215.147]) by smtp.gmail.com with ESMTPSA id l8-20020a170903120800b001a674fb0dd8sm11691476plh.247.2023.05.14.11.53.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 14 May 2023 11:53:40 -0700 (PDT) Message-ID: <64612e34.170a0220.28faa.5dcb@mx.google.com> X-Google-Original-Message-ID: Received: by Mac-mini.local (Postfix, from userid 501) id C292F8D765FA; Mon, 15 May 2023 02:15:47 +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> User-agent: mu4e 1.10.3; emacs 30.0.50 From: "Christopher M. Miles" To: Ihor Radchenko Cc: "Christopher M. Miles" , Org-mode Subject: [PATCH v2] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist` Date: Mon, 15 May 2023 02:14:35 +0800 In-reply-to: <871qjiiziz.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::62f; envelope-from=numbchild@gmail.com; helo=mail-pl1-x62f.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-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1684090486; a=rsa-sha256; cv=none; b=S3tZ/5l8MgXEjQgQqDbwX45Q+5X8rCud3TLC0pxa92DhvGbH96PTPbyDghoJ66Jo70tb6e dZNOMy98nuF4FSNfJtJ5tMMWvkTfK31uXGIKF2kRpkSyFOXh9xW4pu1YASs92fA30QrQrJ 1dhsH5mytpKNcgxpPHrcWHYc5Glfvzy4x0jpPBAFkc/um1JWS4Q7NrcDZ49W7pkk8tmbom R7aj3W4NPdsx1P5V2itPS9KSEzW6txqiOtkLtEa1DhW6eKWytZQ9q0lM6fksfzpndw+qWa tyVUUV/NviLrlJ6FfCZ3HL+LI8F5G/6TWhvcOB3FmGRIHbsmM04qOS+1CDyOsQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cfch6eyg; 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=1684090486; 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=HPYe9BgVSuj1VillW5V/YOqWEldck2i2CvV4PXMl7uA=; b=f+1bV/oS4Om9IVvsDT0o84AtBJQW0DO767XtQaWu5M5D8nhERtk4pUoGTFURX+HazY+J9q VRZijbMd/Iq33KjIiXu4kaHt3koWvJ819GluCvFR0FaQWdAjQa44moOoVgO8K4fJ33RRFt YRWJChIslF1UwZykqw2jz064IYItmlDccv+mA3JqEnVs2YjVTB4chSpp0uzlhvpO1g2lMs yu51JuBa0A05CJpYXUNooDiFRDWA0odR0r65IPS4psSFCgiH+u6kebEiSBJQfdntvGDXq3 73rNGIp76rEL75u/T2oph/72YHsLm42VqVKodvByT3eaEloOrkTo4AcfDj4xAQ== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cfch6eyg; 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: -8.37 X-Spam-Score: -8.37 X-Migadu-Queue-Id: 8CACE2E9E6 X-TUID: 8Jv8T6h2xdCx --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Ihor Radchenko writes: > "Christopher M. Miles" writes: > >>>> #+begin_src emacs-lisp >>>> (let ((bound-tags (seq-filter 'cdr temp-fulltable))) >>>> (if (length> bound-tags 0) >>>> bound-tags >>>> (seq-take temp-fulltable 26))) >>>> #+end_src >>> >>> This will unconditionally drop auto-labeled tags when user-bound tags >>> exist, even if the total number of tags in buffer does not exceed 26. >> >> I try to read the source code of `org-fast-tag-selection', but the code is hard to read. > > Yeah. I agree. But we have what we have. > >> I don't know how to keep auto-labeled tags. Do you have any suggestions? > > You are almost there. > Just run your code only when (lentgh> fulltable 26). > > Of course, 26 should be a defcustom rather than a hard-coded constant. > And do the same for `org-fast-todo-selection'. Ok, I added defcustom option, and add cl-case condition on custom option `org-use-fast-tag-selection'. --=-=-= 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=20569368aa9b3c7aa5bf1063d3e9c152db5304f4f3 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Sat, 13 May 2023 22:22:25 +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. =2D-- lisp/org.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 542959f73..5d6687b7a 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.") @@ -11935,7 +11941,13 @@ Returns the new tags string, or nil to not change = the current settings." (org-fast-tag-insert "Current" current c-face "\n\n") (org-fast-tag-show-exit exit-after-next) (org-set-current-tags-overlay current ov-prefix) =2D (setq tbl fulltable char ?a cnt 0) + (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable))) + (cl-case org-use-fast-tag-selection + (auto (if (length> bound-tags org-fast-tag-selection= -maximum-tags) + bound-tags + (seq-take fulltable org-fast-tag-selection-m= aximum-tags))) + (t fulltable))) + char ?a cnt 0) (while (setq e (pop tbl)) (cond ((eq (car e) :startgroup) =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----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmRhJVAACgkQG13xyVro msPQHwgAxfYKL8cWlLpiUZ4DwTMz3c/y0AFPnWDj9vZkRshYIavJFLN8aI1Xn4br ydEP85xcwmtkcxHc6XBmFp3hvMv/Kqei0bKduttNusA9bmI9gxPuUHOxyqp4ePPR rLVsGW+Kw00uYvydMFgrsFnU7LYZRTSvNlt9limTOtmxlPtNhOmVcFaoL8K95lBc mDF/G8/ereUIHPyp6lZkcjuoKILI9BLE8BpTrPlQr6zSJ8F4ghymZusHs+IB5H8d qmbu8K09WhWQISBxJ/V++sK9+vDXSgvqNymzaaJXzWe88UqNVdgAAeFCOHGehez0 1So6MyN9Hg8ERxLSPeCKD3pZ+yh7SQ== =VE9V -----END PGP SIGNATURE----- --==-=-=--