emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: stardiviner <numbchild@gmail.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`
Date: Sat, 13 May 2023 07:43:13 +0000	[thread overview]
Message-ID: <878rds1xta.fsf@localhost> (raw)
In-Reply-To: <CAL1eYuK7GUx_=47e8+N5Jh+ZJnDexY+CDMUjPjJHNmcMiVVRrQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

stardiviner <numbchild@gmail.com> writes:

> I have a large `org-tag-alist` value that contains about ~7000 tags.
> When I press [C-c C-q] `org-set-tags-command`. Emacs suspends a long time.

Indeed. That's because `org-fast-tag-selection' tries to put all those
7k tags into tag selection window.

We can probably limit the maximum number of tags in the quick selection
window.

Can you try the attached simple diff for `org-fast-tag-selection' and
check if it is enough to solve the hang?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: limit-tag.diff --]
[-- Type: text/x-patch, Size: 517 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index c148409d9..d745fd01e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11765,7 +11765,7 @@ (defun org-fast-tag-selection (current inherited table &optional todo-table)
 	(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)
-	(setq tbl fulltable char ?a cnt 0)
+	(setq tbl (seq-take fulltable 26) char ?a cnt 0)
 	(while (setq e (pop tbl))
 	  (cond
 	   ((eq (car e) :startgroup)

[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  reply	other threads:[~2023-05-13  7:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13  4:49 Improve the performance of `org-set-tags-command` on large `org-tag-alist` stardiviner
2023-05-13  7:43 ` Ihor Radchenko [this message]
2023-05-13  9:39   ` Christopher M. Miles
2023-05-13 11:13   ` stardiviner
2023-05-13 11:26     ` Ihor Radchenko
2023-05-13 14:24       ` [PATCH] " Christopher M. Miles
2023-05-13 18:43         ` Ihor Radchenko
2023-05-14  1:54           ` Christopher M. Miles
2023-05-14  8:09             ` Ihor Radchenko
2023-05-14 14:27               ` Christopher M. Miles
2023-05-14 14:58                 ` Ihor Radchenko
2023-05-14 16:27                   ` Christopher M. Miles
2023-05-14 17:38                     ` Ihor Radchenko
2023-05-14 18:14                       ` [PATCH v2] " Christopher M. Miles
2023-05-15 10:59                         ` Ihor Radchenko
2023-05-15 12:43                           ` Christopher M. Miles
2023-05-15 13:14                             ` Ihor Radchenko
2023-05-15 14:40                           ` [PATCH v3] " Christopher M. Miles
2023-05-15 16:12                             ` [PATCH v3.1] " Christopher M. Miles
2023-05-16  9:31                               ` Ihor Radchenko
2023-05-16 12:12                                 ` [PATCH v4] " Christopher M. Miles
2023-05-16 18:53                                   ` Ihor Radchenko
2023-05-17  5:57                                     ` [PATCH v4.1] " Christopher M. Miles
2023-06-30 12:55                                       ` Ihor Radchenko
2023-07-01 10:31                                         ` [PATCH v5] " Christopher M. Miles
2023-07-01 11:34                                           ` Ihor Radchenko
2024-01-09 14:12                                             ` [PATCH v6] " Ihor Radchenko
2024-01-10  3:48                                               ` Christopher M. Miles
2024-01-12 12:00                                                 ` Ihor Radchenko
2023-05-16 12:12                                 ` [PATCH v4] " Christopher M. Miles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rds1xta.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=numbchild@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).