From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 S2brAPZ1Y2Q3UAEASxT56A (envelope-from ) for ; Tue, 16 May 2023 14:24:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id AHNqO/V1Y2TQvQAAauVa8A (envelope-from ) for ; Tue, 16 May 2023 14:24:21 +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 7DB0D17177 for ; Tue, 16 May 2023 14:24:21 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pytiG-0005xu-25; Tue, 16 May 2023 08:23:32 -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 1pytiE-0005wt-7S for emacs-orgmode@gnu.org; Tue, 16 May 2023 08:23:30 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pytiC-0001AJ-F1 for emacs-orgmode@gnu.org; Tue, 16 May 2023 08:23:29 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1aaf2ede38fso136261755ad.2 for ; Tue, 16 May 2023 05:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684239807; x=1686831807; h=mime-version:in-reply-to:reply-to:date:subject:cc:to:newsgroups :from:user-agent:references:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Jb1GY9fyeqvCXA7VTYbsZOCk4TwqTgR/tW5IFLMCza4=; b=SDF4WIIBKIqJ6pglPlXbjJXspmwaG2KR+MYzHzFUG9iUuIQJAtNMqLs8TPp0zv9+cx 97EavZOk4x5dgjt84thK8wrMHlUk/npBYhGDwUVbouyLhvyGVVCZd46QFMDLjejhhOIV lbItIpg1hsJfmOc7OQKo6maqj8bgzKek3gLLwlb2XyGMTfxC6B3KHn3KKbuhXVRcc8Rr hgjZcH/w/c9D+tTy5/wUCG2eCo+YSwjA1LHtUBIOiLWNOQCx3/dERImrE1abk9Rbl/fo YftDW71xi57a4JFGs5Qk6CwnAH74of07IFL77347FcRZT5VRpLa0spfowgS+qRez2aq2 iUnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684239807; x=1686831807; h=mime-version:in-reply-to:reply-to:date:subject:cc:to:newsgroups :from:user-agent:references:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jb1GY9fyeqvCXA7VTYbsZOCk4TwqTgR/tW5IFLMCza4=; b=TwSHjvtR6+zMRjj2slt1/jzQc7xCBUbjhNCeXfL1Y8JgRNLvlpFNbjdDAGPsYGe/gI JVlnPm8bWqApZqor/nwzwUbtymHRGAGWqvK2x9OEptncZyEzJOggDwvfFPxccx9frEPV +XIUW56LEShEYz3PiU+6toQN9BbPytKMkszOwMrUrlRC4fistzs0vEib/C/6d0G0T2Ri rySzdGUwApVCYGWT45LOUDM/juKVokvf0pi0lvjsyqTs73l4kaiAbmfoRdfSHg7ro/SO rl5dAlqrDvTyZCHC8ZfVtiB7tpNCw5LwhFpFK/eT6mYpbrenaSt0wwgY39or7CFsd9rp I+Ww== X-Gm-Message-State: AC+VfDw9wqJFEym79ziin7cfY+SNYH4HhRGogJjulf3+GTSPAzPh/JLP BGTePHFk1gkGFMeLSHUGtQ== X-Google-Smtp-Source: ACHHUZ5ZjA3p+4Otcvv6rwStVViOqELqThcl94DCD3fLtVNqIxQ4uyMKReuWiQ8k4EPqT3cuWndjUA== X-Received: by 2002:a17:902:ea09:b0:1ac:4e32:738e with SMTP id s9-20020a170902ea0900b001ac4e32738emr49765247plg.42.1684239807060; Tue, 16 May 2023 05:23:27 -0700 (PDT) Received: from Mac-mini.local ([39.171.215.147]) by smtp.gmail.com with ESMTPSA id m17-20020a170902bb9100b001aaef9d0102sm15337307pls.197.2023.05.16.05.23.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 May 2023 05:23:25 -0700 (PDT) Message-ID: <646375bd.170a0220.b1c70.dbf1@mx.google.com> X-Google-Original-Message-ID: Received: by Mac-mini.local (Postfix, from userid 501) id C0FDE8DDE4B7; Tue, 16 May 2023 20:16:43 +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> User-agent: mu4e 1.10.3; emacs 30.0.50 From: "Christopher M. Miles" Newsgroups: To: Ihor Radchenko Cc: "Christopher M. Miles" , Org-mode Subject: [PATCH v4] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist` Date: Tue, 16 May 2023 20:12:50 +0800 In-reply-to: <87v8gs4o88.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::634; envelope-from=numbchild@gmail.com; helo=mail-pl1-x634.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=1684239861; a=rsa-sha256; cv=none; b=uvk0Di3jKSPRmCsEIRVUgt9Bdn7rqlDqKrSY8qcMSgExosaLPIksTceZKL0HRPo5/ozkvj TpaheWxcVMe9BLTDqC6qN/MTAQqdwLF0k3wFdbc1fxJ6EYVfnwFrYC1GkEXpmTJFXbHaxy tn+XgaOwwTxmTuuU7hw4ILH6KLj9TChQluHcgJk5mRRf1ugBN4sCeqNdFUWDQzCX9MTQFh sNjk3SriZIHLsFugKw0ds8SE+UzA4ljXZQG76vRGRuSSXMUwax3HDWzJt92n+S26qrhnE0 COURAPVhTWm0uv1pmmsy/jMSf8zWCtkJ2TSPSybsxu7CdWGUHxr++zDnRYquVg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=SDF4WIIB; 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=1684239861; 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=Jb1GY9fyeqvCXA7VTYbsZOCk4TwqTgR/tW5IFLMCza4=; b=ouQyjZUGPOmiLhh0Slrdqzoc6hXUmfaOxIkfEWC73o5f7ZMwBC1AyvKUyliBUnU5xwnL3/ hVnaZyo/wH7xyYcMyz9iALSyva45fu+IQGKvi+hYI88kiLrLMFFTJB5RBy6bSUbavlUhNg mXJTSJ08vC/vpsDYtKsKP1g6+hibmjQDyPsKNAH5yDYjQ+AZLy5Wbqm/CHZr9rXRPYqc9+ khs7sgAfLuWbvMJjAP0TdwyFMnJcIFFDK1Fm96cjCr+HV2iJMrbuyaLK0ymIBQPAdJ4i5/ NK18TX2FQ9wSUOpha5zlVSRaDOxFyjygj7bdG2pjQrXYmLPruHi2pekKiXtMWA== X-Migadu-Spam-Score: -13.27 X-Spam-Score: -13.27 X-Migadu-Queue-Id: 7DB0D17177 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=SDF4WIIB; 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-TUID: mRnwV3piNQQP --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> Updated version which fix the `message` error in upper code: > > Thanks! > >> #+begin_src emacs-lisp >> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable))) >> (if (length< fulltable org-fast-tag-selection-maximu= m-tags) > > Because of (:startgroup) markers and similar things, this condition is > not fully accurate. See `org-tag-alist' docstring. > > You may also need to consider special alist items in the rest of the code. > I added a let-binding to modify fulltable at first to filter out special ta= g markers. >> fulltable >> (if (length< bound-tags org-fast-tag-selection-max= imum-tags) >> (progn >> (insert "Tags are limited displayed by `org-= fast-tag-selection-maximum-tags'.\n") > > If you want to have proper Elisp symbol markup when using `...', use > `format-message'. Updated. > >> (seq-take (seq-uniq (append bound-tags fullt= able)) >> org-fast-tag-selection-maximum-tag= s)) > > This will behave awkwardly with tag groups. You may better use `org--tag-= add-to-alist'. I think here should use `append' instead of `org--tag-add-to-alist' to merg= e. Using `append': #+begin_example Inherited: video Current:=20=20=20=20 Tags are limited displayed by =E2=80=98org-fast-tag-selection-maximum-tags= =E2=80=99. [d] drill [z] crypt = [A] ARCHIVE=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 [E] noexport [P] private = [D] deprecated=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 [O] outdated [t] translate = [i] idea=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [h] book [b] bookmark = [w] work=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [a] appointment [m] meeting = [u] urgent=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 [X] SEX [k] wiki = [C] code=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [e] Emacs [o] Org_mode = [G] git=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 [L] Linux [M] macOS = [W] Windows=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 [l] LISP [c] Clojure = [s] ClojureScript=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 [J] Java [S] Shell = [p] Python=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 [r] Ruby [j] JavaScript = [d] database=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 [f] LOG [g] @marks = [n] on=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 [q] off [v] star = [x] like=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [y] favorite [{] suggested = [|] heart=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [}] smile [~] brain = [ ] check=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [ ] alert [ ] important = [ ] flag=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [ ] error [ ] label=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 #+end_example Using `org--tag-add-to-alist': #+begin_example Inherited: video Current:=20=20=20=20 Tags are limited displayed by =E2=80=98org-fast-tag-selection-maximum-tags= =E2=80=99. [d] drill [z] crypt = [f] LOG=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 [A] ARCHIVE [E] noexport = [P] private=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 [D] deprecated [O] outdated = [g] @marks=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 [n] on [q] off = [v] star=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [x] like [y] favorite = [{] suggested=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20 [|] heart [}] smile = [~] brain=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [ ] check [ ] alert = [ ] important=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20 [ ] flag [ ] error = [ ] label=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [ ] question [ ] info = [ ] quote=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [ ] table [t] translate = [ ] language=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 [i] idea [ ] comment = [ ] screenshot=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 [ ] trash [ ] delete = [ ] clear=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 [ ] cancel [ ] lock = [ ] unlock=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 [ ] key [ ] refresh = [ ] repeat=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 [ ] shuffle [h] book = [b] bookmark=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 [ ] note [ ] cheatsheet = [ ] paperclip=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20 [ ] plot [ ] diagram=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 #+end_example You can see the bound key tags are not fully displayed in buffer at second = solution. Here is the updated code: #+begin_src emacs-lisp (setq tbl (let* ((fulltable-accurate (delq nil (seq-filter (lambda (tag) (and (not (member tag '((:startgrouptag)= (:grouptags) (:endgrouptag)))) tag)) fulltable))) (bound-tags (seq-filter 'cdr fulltable-accurate))) (if (length< fulltable-accurate org-fast-tag-selection-= maximum-tags) fulltable (if (length< bound-tags org-fast-tag-selection-maximu= m-tags) (progn (insert (format-message "Tags are limited displ= ayed by `org-fast-tag-selection-maximum-tags'.\n")) (seq-take (seq-uniq (append bound-tags fulltabl= e-accurate)) ; TODO: consider to use `org--tag-add-to-alist'? org-fast-tag-selection-maximum-tags)) (insert "Tags are limited displayed only has key bo= und.\n") bound-tags))) char ?a cnt 0) #+end_src =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----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmRjdCgACgkQG13xyVro msOyOAf/VRhvMToEAxV5+qOBd+eS12fVnHUYKfrS0CRwgl4U2t10Los5xHDhVefT RhpirgHLSq+az0hMgbYT1qHNRQfynKkcMtmAtgsgcvrk/tUSDUp6O95x6jziWhNn srS5D2YTKUi5l/kvf6xIvTWQPWPWoWhE0E9jKoGS56Cv09DJPSwPg4+oHGXi28Ef /adw/8cv/loh3Qtag50SuhGGZU1jHu6GreedVO7hUX0PEBT3CqBGilfUlQRCEpMu UGYLzNx/60nGXao0QESlh9fYyX7+7uN9pf6RkY3IdgAZ1jdlDLsGjUvPxIrfyfvb h+6IUbYEsiTR1jGOkxhnDksxheR/lQ== =BCTj -----END PGP SIGNATURE----- --=-=-=--