append-to-last, tags-add - clarify code
This commit is contained in:
parent
4fbce30490
commit
5840e6bc27
|
@ -73,15 +73,19 @@ be removed."
|
|||
(old-start (plist-get old-expr :start))
|
||||
(old-stop (plist-get old-expr :stop))
|
||||
(old-tags (plist-get old-expr :tags))
|
||||
;; Anything that's left will be the user's key-values.
|
||||
(old-kvs (chronometrist-plist-remove old-expr :name :tags :start :stop))
|
||||
(plist-clean (chronometrist-plist-remove plist :name :tags :start :stop))
|
||||
;; Prevent the user from adding reserved key-values.
|
||||
(plist (chronometrist-plist-remove plist :name :tags :start :stop))
|
||||
(new-tags (if old-tags
|
||||
(-> (append old-tags tags)
|
||||
(cl-remove-duplicates :test #'equal))
|
||||
tags))
|
||||
;; In case there is an overlap in key-values, we use
|
||||
;; plist-put to replace old ones with new ones.
|
||||
(new-kvs (cl-copy-list old-expr))
|
||||
(new-kvs (if plist-clean
|
||||
(-> (cl-loop for (key val) on plist-clean by #'cddr
|
||||
(new-kvs (if plist
|
||||
(-> (cl-loop for (key val) on plist by #'cddr
|
||||
do (plist-put new-kvs key val)
|
||||
finally return new-kvs)
|
||||
(chronometrist-plist-remove :name :tags :start :stop))
|
||||
|
@ -182,11 +186,11 @@ used in `chronometrist-before-out-functions'."
|
|||
(chronometrist-tags-prompt last-name)
|
||||
(chronometrist-maybe-string-to-symbol))))
|
||||
(when input
|
||||
(-> (append last-tags input)
|
||||
(reverse)
|
||||
(cl-remove-duplicates :test #'equal)
|
||||
(reverse)
|
||||
(chronometrist-append-to-last nil)))
|
||||
(--> (append last-tags input)
|
||||
(reverse it)
|
||||
(cl-remove-duplicates it :test #'equal)
|
||||
(reverse it)
|
||||
(chronometrist-append-to-last it nil)))
|
||||
t))
|
||||
|
||||
;;;; KEY-VALUES ;;;;
|
||||
|
|
Reference in New Issue