fix(details): do not display user keywords if using format string

This commit is contained in:
contrapunctus 2021-06-05 15:18:12 +05:30
parent 2dc8010056
commit 343a08665f
2 changed files with 10 additions and 6 deletions

View File

@ -1975,7 +1975,8 @@ ARG must be either tags (a list of symbols) or a plist."
(let (contents custom)
(if (chronometrist-plist-p list)
(setq custom chronometrist-details-display-key-values
contents (chronometrist-plist-key-values list))
contents (seq-remove #'keywordp
(chronometrist-plist-key-values list)))
(setq custom chronometrist-details-display-tags
contents list))
(if (and contents custom)
@ -1983,7 +1984,7 @@ ARG must be either tags (a list of symbols) or a plist."
((pred stringp)
(mapconcat
(lambda (elt) (format custom elt))
list " "))
contents " "))
((pred functionp)
(funcall custom list)))
"")))

View File

@ -3140,7 +3140,8 @@ ARG must be either tags (a list of symbols) or a plist."
(let (contents custom)
(if (chronometrist-plist-p list)
(setq custom chronometrist-details-display-key-values
contents (chronometrist-plist-key-values list))
contents (seq-remove #'keywordp
(chronometrist-plist-key-values list)))
(setq custom chronometrist-details-display-tags
contents list))
(if (and contents custom)
@ -3148,7 +3149,7 @@ ARG must be either tags (a list of symbols) or a plist."
((pred stringp)
(mapconcat
(lambda (elt) (format custom elt))
list " "))
contents " "))
((pred functionp)
(funcall custom list)))
"")))
@ -3167,8 +3168,10 @@ ARG must be either tags (a list of symbols) or a plist."
(chronometrist-details-display-key-values "%s"))
(should (equal (chronometrist-details-rows-helper nil) ""))
(should (equal (chronometrist-details-rows-helper nil) ""))
(should (equal (chronometrist-details-rows-helper tags) "a b c"))
(should (equal (chronometrist-details-rows-helper plist) ":a 1 :b 2 :c 3")))))
(should (equal (chronometrist-details-rows-helper tags)
"a b c"))
(should (equal (chronometrist-details-rows-helper plist)
"1 2 3")))))
#+END_SRC
**** row-transformers :extension:variable: