From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 mCAgLIcPoGSADwAASxT56A (envelope-from ) for ; Sat, 01 Jul 2023 13:35:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eP/ZK4cPoGQ+aQEAauVa8A (envelope-from ) for ; Sat, 01 Jul 2023 13:35:35 +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 87DB84112D for ; Sat, 1 Jul 2023 13:35:35 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFYsB-00066T-26; Sat, 01 Jul 2023 07:34:39 -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 1qFYs9-00066G-Ff for emacs-orgmode@gnu.org; Sat, 01 Jul 2023 07:34:37 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFYs7-0001LZ-6e for emacs-orgmode@gnu.org; Sat, 01 Jul 2023 07:34:37 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B02F6240101 for ; Sat, 1 Jul 2023 13:34:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1688211272; bh=b2HYEwltGzpl9IdmAWi/rLsBqdwMNfa+a2ji9dTJJA0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=Z4H+N7liy8pEuVo9ZtUsd7Pb7GzMMxpBIdQVuno4dvZVJJ/MeE7B8MJrc+zQfnPop teL+iLlJjDegV7KpYxfcdik0TxHgaztwg+jTQxglD4vrlAb1nZP58DCBsA/xsuqzTy zfUUwa/Luso3dFaUOFDmKlCpN8SsjhO+qMnsq1BfwTSiBq/BYlZhltU6s3GhZhQtpt 76MUJtiyP08umo71v1ZBLeMQeMkKE5p0Wn/aw7G+TCN+JLLMFyP6RMfyEk3qf8eqUh R396HveW3ApWEK7j9kg/mAmZvutslyG25sPrW2FODEfZ8sQR9/O6hclPIpgmIaCP5c fYOHEg7PjPvPg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QtVTM6pJHz9rxG; Sat, 1 Jul 2023 13:34:31 +0200 (CEST) From: Ihor Radchenko To: "Christopher M. Miles" Cc: Org-mode Subject: Re: [PATCH v5] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist` In-Reply-To: <64a000ea.170a0220.250a9.7355@mx.google.com> References: <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> <64a000ea.170a0220.250a9.7355@mx.google.com> Date: Sat, 01 Jul 2023 11:34:31 +0000 Message-ID: <87pm5boofs.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688211335; h=from:from:sender:sender: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=zmWxsJprDcHZpA/RtmiCHc2iVbbM9BZsLlkbcxJRwoI=; b=mEHRx/jN8kfd1kjz2GWyTDcd60Q2sGskKaauzJsI3ozFG6udYX7iFswNg6k9WuSTFbmqR+ 3ntwMUYxvCgh0cszmiQelnZl+ChmnwnyJfRy28Xx3dBx03Q9Xxepb382rvsqknjf/yaI4O gyBxuuWerxzbOl8O824vscADc+2SUNgZ7X+QS0Hw87Gm/wRTXdbkcoCLFwHjT9Ktx5+Md8 nZ9YdjFIv7mKyF8FtMUSeuNXecj7kEnQPjz/QHaRhwiC+ZAQEbmS+QXonFFUtqRW4c0pXZ upr0UvTBJYS7uVjjk4yAAzY93/AF+c8YK1wIGitSy5zshJmWO5PC0zzENvRxYg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Z4H+N7li; dmarc=pass (policy=none) header.from=posteo.net; 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-Seal: i=1; s=key1; d=yhetil.org; t=1688211335; a=rsa-sha256; cv=none; b=XjbFOZJVDc2pC+kSttbrsmTDa9Dozm/bPncPQjhnopTY8UXvPz86/fkVPS4GKHCPFU14Tj AVSEDV+dctZ8Ww1pM6IC+VbUJy1X/6khVTj2zR6suSDt9dkPoc5rU0krUzAp5O1LTskVla nmOZ6hN+svtkW2WC/DTEveo0MoChJ1CGpxTV4A3YWF4APZsB8yyjHa6KZWArZaQ2SvJ6bb ploQd+jIlPzxgSQQ9+iot/ylBrmWQdPYRwjz2d7ynobONyqvAEZNcfTlhD+DAlg3MpwPN5 yvkkpNkYtld4LBy4Ts0l76CuWALpjkNMEUeZ6YiKfiZQYUlCI3IgBqhZszxkmg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.73 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Z4H+N7li; dmarc=pass (policy=none) header.from=posteo.net; 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-Queue-Id: 87DB84112D X-Spam-Score: -4.73 X-TUID: xl37tOlrOh0a "Christopher M. Miles" writes: > Ok, I update and re-generated the patch, also add new document and Org NEWS entries. Thanks! See my comments below. > * 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. Why only for 'auto? > * doc/org-manual.org (org-fast-tag-selection-maximum-tags): Add new > custom option document. *documentation. > --- 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)}}}. > > +#+vindex: org-fast-tag-selection-maximum-tags > +Limit the tags table when you have many tags. You can set the maximum #+vindex entry will not be visible in the rendered manual. So, the first sentence of the paragraph reads awkwardly. Also, please use double space between sentences. It is the convention for Org manual, docstrings, and commit messages. See doc/Documentation_Standards.org > +(defcustom org-fast-tag-selection-maximum-tags 26 > + "Set the maximum tags number for fast tag selection." > + :group 'org-tags > + :type 'number > + :safe #'numberp) Why 26? We use a-zA-Z{|}~ ;; Characters available for auto-assignment. (tag-binding-char-list (eval-when-compile (string-to-list "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~"))) Also, please add :package-version keyword in the defcustom. > (let* (;; Combined alist of all the tags and todo keywords. > - (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-selection-maximum-tags) > + binding-tags > + (seq-take tags-table org-fast-tag-selection-maximum-tags))) > + (t tags-table)))) May you please instead: 1. Store the total number of bound tags, but using a bit more complex filter (`(:startgroup "foo")', `(:endgroup "bar")' are also valid alist members, but do not correspond to tag bindings). See `(pcase tag-binding-spec ...)' 2. Store the total number of tag in tag groups. See `ingroup'. 3. Add these two numbers and compare them with `org-fast-tag-selection-maximum-tags', calculating how many extra tags can be displayed. 4. Do not filter `tag-alist', but instead plug a code into `(while (setq tag-binding-spec (pop tag-alist)) ...)', counting how many tags are in There, in `;; Insert the tag.', only insert the tag when (1) tag has binding - (cdr tag-binding-spec); (2) tag is in a group - ingroup; (3) we still have space for extra tags, according to (3), then also decrease the leftover tag count. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at