Ihor Radchenko <[email protected]> writes: > "Christopher M. Miles" <[email protected]> writes: > >>>> (seq-take (seq-uniq (append bound-tags >>>> fulltable)) >>>> org-fast-tag-selection-maximum-tags)) >>> >>> This will behave awkwardly with tag groups. You may better use >>> `org--tag-add-to-alist'. >> >> I think here should use `append' instead of `org--tag-add-to-alist' to merge. > > 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-to-groups fulltable)))
(bound-tags (seq-filter 'cdr fulltable)))
;; TODO: consider tag groups.
;; 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.
(if (length< fulltable-accurate
org-fast-tag-selection-maximum-tags)
fulltable
(if (length< bound-tags
org-fast-tag-selection-maximum-tags)
(progn
(insert (format-message "Tags are limited displayed
by `org-fast-tag-selection-maximum-tags'.\n"))
;; TODO:
(seq-take (seq-uniq (org--tag-add-to-alist
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
signature.asc
Description: PGP signature
