Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

>>> #+begin_src emacs-lisp
>>> (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
>>>   (if (length> bound-tags 0)
>>>   bound-tags
>>> (seq-take temp-fulltable 26)))
>>> #+end_src
>>
>> This will unconditionally drop auto-labeled tags when user-bound tags
>> exist, even if the total number of tags in buffer does not exceed 26.
>
> I try to read the source code of `org-fast-tag-selection', but the code is 
> hard to read.

Yeah. I agree. But we have what we have.

> I don't know how to keep auto-labeled tags. Do you have any suggestions?

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'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> Sorry, wrong code, here is the correct code snippet:
>>
>> #+begin_src emacs-lisp
>> (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
>>   (if (length> bound-tags 0)
>>   bound-tags
>> (seq-take temp-fulltable 26)))
>> #+end_src
>
> This will unconditionally drop auto-labeled tags when user-bound tags
> exist, even if the total number of tags in buffer does not exceed 26.

I try to read the source code of `org-fast-tag-selection', but the code is hard 
to read.
I don't know how to keep auto-labeled tags. Do you have any suggestions?


-- 

[ 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


signature.asc
Description: PGP signature


Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> Sorry, wrong code, here is the correct code snippet:
>
> #+begin_src emacs-lisp
> (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
>   (if (length> bound-tags 0)
>   bound-tags
> (seq-take temp-fulltable 26)))
> #+end_src

This will unconditionally drop auto-labeled tags when user-bound tags
exist, even if the total number of tags in buffer does not exceed 26.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> What about like this?
>>
>> #+begin_src emacs-lisp
>> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
>> (if (length> shortkeys 0)
>> bound-tags
>>   (seq-take fulltable 26)))
>>   char ?a cnt 0)
>> #+end_src
>
> What do you mean by "shortkeys"?

Sorry, wrong code, here is the correct code snippet:

#+begin_src emacs-lisp
(let ((bound-tags (seq-filter 'cdr temp-fulltable)))
  (if (length> bound-tags 0)
  bound-tags
(seq-take temp-fulltable 26)))
#+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


signature.asc
Description: PGP signature


Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> What about like this?
>
> #+begin_src emacs-lisp
> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
> (if (length> shortkeys 0)
> bound-tags
>   (seq-take fulltable 26)))
>   char ?a cnt 0)
> #+end_src

What do you mean by "shortkeys"?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-13 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> It would be great if you can come up with a patch.
>>> 1. Keeping tags with explicitly assigned key binding indeed makes sense
>>> 2. If we limit the number of displayed tags (on top of explicitly
>>>assigned), it should be a defcustom.
>>
>> Here is the patch.
>> -(setq tbl fulltable char ?a cnt 0)
>> +(setq tbl (seq-filter 'cdr fulltable) char ?a cnt 0)
>
> Thanks, but it will make the tag selection useless for people who did
> not customize explicit tag bindings.
>
> You should instead only filter when the number of tags exceeds some
> customized value.

What about like this?

#+begin_src emacs-lisp
(setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
(if (length> shortkeys 0)
bound-tags
  (seq-take fulltable 26)))
  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


signature.asc
Description: PGP signature


Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-13 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

>> It would be great if you can come up with a patch.
>> 1. Keeping tags with explicitly assigned key binding indeed makes sense
>> 2. If we limit the number of displayed tags (on top of explicitly
>>assigned), it should be a defcustom.
>
> Here is the patch.
> - (setq tbl fulltable char ?a cnt 0)
> + (setq tbl (seq-filter 'cdr fulltable) char ?a cnt 0)

Thanks, but it will make the tag selection useless for people who did
not customize explicit tag bindings.

You should instead only filter when the number of tags exceeds some
customized value.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at