From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id wFmDDSR9Y2RbzQAASxT56A (envelope-from ) for ; Tue, 16 May 2023 14:55:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id OJilDCR9Y2SFBgEAG6o9tA (envelope-from ) for ; Tue, 16 May 2023 14:55:00 +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 E3A29127E2 for ; Tue, 16 May 2023 14:54:59 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyuBy-0006MZ-Oq; Tue, 16 May 2023 08:54:18 -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 1pyuBG-0005re-O2 for emacs-orgmode@gnu.org; Tue, 16 May 2023 08:53:34 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pyuBD-00085S-6g for emacs-orgmode@gnu.org; Tue, 16 May 2023 08:53:28 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-644d9bf05b7so8196300b3a.3 for ; Tue, 16 May 2023 05:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684241606; x=1686833606; 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=f2xwRe+hTnr9qvYUssIYRqL8upWv9+pocLYi2Bnv/0EenQi4XT/uw7VrtFQHMPzVX9 cGyW7Nlygsv4789NuU427otclpi5Ot7WvmqkBxib8SL8WPc9FlG6S0vhmBQR4p3/3GRo 1eDil0WGFMvrhPz1fZESf/rTInosJDQ6BQlb32nj1CC6g0hPLn08njzRVr+FJot04/GQ LUrjLzmMihHIaG81495qB1TdAKu8n+4+MjAmAW5nNN+m3WxiMnBD4H3FBrjh39x94jWk ArVFcxcHb2fxd2HlBB+19Ok2XX5ZqOSXXbNgu5+R5mIoAHWeViqVL6mn5IchLk7W8W3e 7HVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684241606; x=1686833606; 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=DRkMsUxYyJGEIpTD7exfPrc/+DlTNp7/q21CHVNPw8hLkIpZbklhZ4XB44rLJXO85K +G2f78Ib4zTPUseKoSQLmb1ulx9LREi71KuYJdE7mhkPfqpttMqLKHpR/767Salb4BTi SGD4wm4oMfZIdWR+4TDDpsXGhBBbF3OZbx8JBn5Lh6Dwz5ODIgTb/bsDQVAaL0ncSggq kYocsaUqqyIUz3ztM6WAHxJH9Zh4hzXGNzD/WBKHvQB+43XJdspbxGzCiKhVDH3DYB37 K1ZlClGefBcQOhctGfiKDXPloRP9RnuVx5YtFT3gHOL19c98VEYVmQ2D4IrF0kPR8A3G +LQw== X-Gm-Message-State: AC+VfDz1NmQ8O2wqhdZ8b77l0hcAVYBMCcS9CxQKlfkql5MB4dBWsdyy DVQQmhtXULU8AayHqFUBXQ== X-Google-Smtp-Source: ACHHUZ4TUnRdZn51v56i1XgMVM12g8QLS3Y3PEz81lGYAy0VqPcABauJbMY2vPaaO8h3z5X9QeXZrA== X-Received: by 2002:aa7:888c:0:b0:63b:859f:f094 with SMTP id z12-20020aa7888c000000b0063b859ff094mr49911596pfe.20.1684241605737; Tue, 16 May 2023 05:53:25 -0700 (PDT) Received: from Mac-mini.local ([39.171.215.147]) by smtp.gmail.com with ESMTPSA id n3-20020aa78a43000000b005d72e54a7e1sm13370395pfa.215.2023.05.16.05.53.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 May 2023 05:53:25 -0700 (PDT) Message-ID: <64637cc5.a70a0220.d2249.9f22@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::434; envelope-from=numbchild@gmail.com; helo=mail-pf1-x434.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=unavailable 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=1684241700; a=rsa-sha256; cv=none; b=A7sGTvBOArZt04x0bNxW9PzPVEV5LebYBkXZwo/Na6QxxThSYqJsmRa3CZlE+HktFiLcZ9 Ux+rDhae6xNYeq2MatzTJ8f4l1oKq7Irf3vaqSv7kBcylVu3JZjApsJ7bqf6/mMCRPhX9V csbBqChGu0YsSESVj8JRKDz1dTk4dQmKRLCK5omN7glvFZKfvP+QToKlCdVPNjejEJCnQA zsoPI1KnM1fRVuzr7jW7zFxKShzO1cXoe6/ozxMoolEkKyugwfbxZqTARn36iWQXqminC8 cbz6ty/hTBIWVSJgjGtqpmI0tISalUPqZjUykFWKGdeMBTy9yZJBf9UsMhlfew== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=f2xwRe+h; 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=1684241700; 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=MKmcUZFoi0jElrmuMI+QJQC/ZG+cLoCVXm54aFzpJCT694nKLBPrJ6r14i3uPndx21TAyd CHlcJr5CQ+XYUCtxfSoVMY4aHuYrzNc//l3HMfbuqgRoh2g8LbSsNtjaulRNueHxPRLTrj 0yOyJXDs52W6uPkbIi9roNXugIu4TwnVIY9ivb7spHke3SwS3sro9n2+/2R01oxHXDFKnd xMrg4v+3VuXd/jgQd2M8iXJFkZ2w5mjtDaGj5Wm8Wmsin7zKu0Kr5hFR/TizYWYWYok0Zz //5TRuc4m0Z6y0negLjkFd+nU7e6DLQe5/hwwdSf3D9CumeiYO1g+lgT8VfSSA== X-Migadu-Spam-Score: -11.97 X-Spam-Score: -11.97 X-Migadu-Queue-Id: E3A29127E2 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=f2xwRe+h; 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: KyauFpBhvuO7 --=-=-= 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----- --=-=-=--