From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 MBe2B15tZGTtvQAASxT56A (envelope-from ) for ; Wed, 17 May 2023 07:59:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id yF6fB15tZGQlJAEA9RJhRA (envelope-from ) for ; Wed, 17 May 2023 07:59:58 +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 6D18C2E356 for ; Wed, 17 May 2023 07:59:57 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzABV-0007dI-8d; Wed, 17 May 2023 01:58:49 -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 1pzABT-0007cv-1J for emacs-orgmode@gnu.org; Wed, 17 May 2023 01:58:47 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pzABR-0002ZP-EN for emacs-orgmode@gnu.org; Wed, 17 May 2023 01:58:46 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-5304d0d1eddso151457a12.2 for ; Tue, 16 May 2023 22:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684303123; x=1686895123; 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=aKH/6qXlJc3hr8f+hD1WmjUNe1/mRm46MaU6Op7+5DI=; b=EpxvkhhDyrmO0+tgxFg5lNHz+nxbmlVLBywgmjP0OO2phW9riUQ1DVdSthGLYDvOvc ufmiH4uPjBqV62f7J4Le7RAw2yUbdtGuUz/dbZveLdhL44+wU9iYdADttn1lNpGszj2n /XL719bPNwrLw+tG0UycymTzotnQx8tNUEGW6jFSsHOgV+5hPLMXpB0XVcVCspC85Mcc Hw0ZFuthIyCcAOVtruxDYjM1PyyRzGEBQjL/9UPsz+HkVOmGxMAwIeBEtmG8t3wh5NN4 AKC5leJ3ZNWPK1wiOZrsmFZ3sRlzLSwBDTtd1HI4jVNEskT9v/eUZerB8y57Z7QZa3u8 Sfcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684303123; x=1686895123; 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=aKH/6qXlJc3hr8f+hD1WmjUNe1/mRm46MaU6Op7+5DI=; b=S5R5vJKdERvXWvpVmyb6A0VD59iXOw/TjszjZBi9mDmbXODZ/XNnv+gpoDRylBb8HH TZQ4Xk8Xfbq8YB1eYsR/f1MPzTep01L0jRLS7Q3VECcVkqxjWqOPGE8DOae6Q2uPs0Nd gLzW2KttmLvsKeJIE5lQwVHix8G/foSghQCSA5k9cXn1RDxnYLVIdaqYYsOcLEUuFzq2 N2/UH2WfDBwa6hLdY/WblhK194d62IpUz/NTzO3Tb/neRai6xA8gQxnxXh59kfFP0RVk 0gP71ZupQE4RIbNKdGmcmyc+2H2AjJ9u3RNDPF12wJqhF1OITcoNJt0O0Go2jNJZf+ND Baeg== X-Gm-Message-State: AC+VfDxhIaISVMbTk45pFYsZzPoKJ8BQR106AZOc7bGrbaKWKFYKRrmK exFO+8U26njUZXwSiHLgpQ== X-Google-Smtp-Source: ACHHUZ5G7WDGglLPDpDNJO4vSFKmIdgW3/FboAk66TNoaAHyO2IQJSw/CqNnU3dkCmy+lYg2MDvxaA== X-Received: by 2002:a17:903:41c6:b0:1ad:f7d9:1ae2 with SMTP id u6-20020a17090341c600b001adf7d91ae2mr18409423ple.55.1684303123348; Tue, 16 May 2023 22:58:43 -0700 (PDT) Received: from Mac-mini.local ([39.171.215.147]) by smtp.gmail.com with ESMTPSA id u4-20020a170902e5c400b001ae197fdbb2sm5461128plf.274.2023.05.16.22.58.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 May 2023 22:58:42 -0700 (PDT) Message-ID: <64646d12.170a0220.b780c.b216@mx.google.com> X-Google-Original-Message-ID: Received: by Mac-mini.local (Postfix, from userid 501) id 641618DF67C6; Wed, 17 May 2023 13:58:33 +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> 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 v4.1] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist` Date: Wed, 17 May 2023 13:57:32 +0800 In-reply-to: <87o7mk3y72.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::531; envelope-from=numbchild@gmail.com; helo=mail-pg1-x531.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=1684303197; a=rsa-sha256; cv=none; b=fTxTG8Q2xDMW539VZEUc5qp8Cf25k09xXE24gRN+hwegsZmmNixFpCqVg6oYgUBqEuy2Hh HzFSQQLXZDay+oq4D8I4U7s9nHNIIetCoqXkXqIZZ5MQnwppGqFIF/cB76170abN2Nf37n oeCtXq7y7t4rLIlJg/BO1yCaG1injIo27//bC4L/VPxclgwOp7fFh/3vCcbvP8ZXvKllda UdUmF9+11/wJ7k1I/r944k5fdYx7/WWgyKbyEvMbof6l3rZK9/ohoQ7SjIyoJC/wzMFMN0 OC8uvCVtlF4qtBGtbGw86IbGtOYu+TQJ52QllmNwA55SPBhKN5I7jB8IlwAOFA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=EpxvkhhD; 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=1684303197; 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=aKH/6qXlJc3hr8f+hD1WmjUNe1/mRm46MaU6Op7+5DI=; b=JTNToe61qCDszpuUKaCeTXRTeWn2sReqNtJpQS3nvSJaE2hQGZ0Qh5IVa3C+tB2LTo2BAP vOu8xe4VlMXimdxbzcHXSvbwUeRWKN6KXmpWRaUzoJD25H/BlxWdKH5UMxVG5fF8mKhw8M PkAUfz+B/K47IT2uWIT3HrtsShjhDxtQNUw/q4g2c0zQE8d54+RkUtvKq5fxRvKiBfV3jt l6BI9B/UrJkceiqytNFLFjyTsABaS1ItM5fS1OUc/A0hpZJq9FrxqaWnvTxxJznxkdofKO AeNZnTrTLfuzqRa4K5hhB17/vH2fgvSTAgxqfvqtMJzbW+2n4wlyiuNI8omS3Q== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=EpxvkhhD; 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: -6.47 X-Spam-Score: -6.47 X-Migadu-Queue-Id: 6D18C2E356 X-TUID: DIxk5RyKo1Nf --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > "Christopher M. Miles" writes: > >>>> (seq-take (seq-uniq (append bound-tags ful= ltable)) >>>> org-fast-tag-selection-maximum-t= ags)) >>> >>> This will behave awkwardly with tag groups. You may better use `org--ta= g-add-to-alist'. >> >> I think here should use `append' instead of `org--tag-add-to-alist' to m= erge. > > Yeah. `org--tag-add-to-alist' does not tell it, but it actually prefers > keeping duplicate tag copies from its second argument. > > Yet, however, tags with their binding assigned might occur inside a > group. Your code will incorrectly pull them out. > > I think that the right approach to handle tag groups and explicitly > bound tags is showing them all the time, even when the total number of > tags exceeds the limit: > > 1. If a tag is bound explicitly (cdr non-nil) show it > 2. If a tag is inside a group - show it > 3. If there is still some room left, show up to the limit. > > My logic is that tag groups and bound tags can only be customized by the > user. So, it makes sense to display them all the time - users likely > expect such behaviour. > > WDYT? 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)) (fulltable-accurate (flatten-list (org-tag-alist-t= o-groups fulltable))) (bound-tags (seq-filter 'cdr fulltable))) ;; TODO: consider tag groups. ;; the right approach to handle tag groups and explicit= ly ;; bound tags is showing them all the time, even when t= he total number of ;; tags exceeds the limit ;;=20 ;; 1. If a tag is bound explicitly (cdr non-nil) show it ;; 2. If a tag is inside a group - show it ;; 3. If there is still some room left, show up to the = limit. (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")) ;; TODO: (seq-take (seq-uniq (org--tag-add-to-alist boun= d-tags fulltable)) 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----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmRkbQYACgkQG13xyVro msOyrggAgwrsinGkvk2Ohd8aBJ+YLim6QDDBmhYOT/aNyI/sGf2pxtGitEOBfi4l Gy2wWnW9qdiYuY5doUjqy7nVyDYtNf/wuHVaK3kiTl2bTpK3ikxZim0yvJKCY05a hH4GPpSAUNpIr3YRNo+0p+TEjEAgmbbAIKBq1Os0c0rcLrGqdUH1t+RxKfkzRDhD DRliwnBfp41nUoMcR5enVR7rKJ2wOVoMyKFqtcQPwtd6XyZzsXLdALAjOfvlEbQX H5oRk9O+o5W+egQKpL24CH5b99MC2eX5tvx9dlr8JBsbvTG72syde+st6EHDAvHw r8a+oZpV+iFcjfQZvJZ+cfeqdasmkg== =j9vQ -----END PGP SIGNATURE----- --=-=-=--