emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3.1] Re: Improve the performance of `org-set-tags-command` on la


From: Christopher M. Miles
Subject: [PATCH v3.1] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`
Date: Tue, 16 May 2023 00:12:55 +0800
User-agent: mu4e 1.10.3; emacs 30.0.50

"Christopher M. Miles" <numbchild@gmail.com> writes:

> [[PGP Signed Part:Undecided]]
>
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> "Christopher M. Miles" <numbchild@gmail.com> writes:
>>
>>>> You are almost there.
>>>> Just run your code only when (lentgh> fulltable 26).
>>>>
>>>> Of course, 26 should be a defcustom rather than a hard-coded constant.
>>>> And do the same for `org-fast-todo-selection'.
>>>
>>> Ok, I added defcustom option, and add cl-case condition on custom option
>>> `org-use-fast-tag-selection'.
>>
>> I do not think that we need to care about the value of
>> `org-use-fast-tag-selection'.  Instead, just
>>
>> 1. If the total number of tags does not exceed
>>    `org-fast-tag-selection-maximum-tags', display them all.
>> 2. If the total number of tags is larger, just display all the bound
>>    tags + any extra tags, up to `org-fast-tag-selection-maximum-tags',
>>    and add a note in the tag selection buffer that more tags are not
>>    displayed.
>
> Ok, I re-implemented the mechanism like bellowing, can you check whether it 
> fits?
>
> #+begin_src emacs-lisp
> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
>                     (if (length< fulltable 
> org-fast-tag-selection-maximum-tags)
>                         fulltable
>                       (if (length< bound-tags 
> org-fast-tag-selection-maximum-tags)
>                           (progn
>                             (seq-take (seq-uniq (append bound-tags fulltable))
>                                       org-fast-tag-selection-maximum-tags)
>                             (message "Tags are limited displayed by 
> `org-fast-tag-selection-maximum-tags'."))
>                         bound-tags
>                         (message "Tags are limited displayed only has key 
> bound."))))
>               char ?a cnt 0)
> #+end_src

Updated version which fix the `message` error in upper code:

#+begin_src emacs-lisp
(setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
                    (if (length< fulltable org-fast-tag-selection-maximum-tags)
                        fulltable
                      (if (length< bound-tags 
org-fast-tag-selection-maximum-tags)
                          (progn
                            (insert "Tags are limited displayed by 
`org-fast-tag-selection-maximum-tags'.\n")
                            (seq-take (seq-uniq (append bound-tags fulltable))
                                      org-fast-tag-selection-maximum-tags))
                        (insert "Tags are limited displayed only has key 
bound.\n")
                        bound-tags)))
              char ?a cnt 0)
#+end_src

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]