mirror of
https://github.com/SqrtMinusOne/org-clock-agg.git
synced 2025-12-10 22:03:03 +03:00
org-clock-agg: docstring formatting & byte compiler
This commit is contained in:
parent
0fec5df0d4
commit
b4c427e0d7
1 changed files with 65 additions and 63 deletions
|
|
@ -248,7 +248,7 @@ manually after setting."
|
|||
- a string, parseable by `parse-time-string', with or without the time
|
||||
part.
|
||||
|
||||
KIND is either 'from or 'to. If it's the latter, the time part is the
|
||||
KIND is either \"from\" or \"to\". If it's the latter, the time part is the
|
||||
to 23:59:59 when possible, otherwise it's 00:00:00.
|
||||
|
||||
The result is a number of seconds since the epoch."
|
||||
|
|
@ -346,8 +346,8 @@ manually after setting."
|
|||
\(org-clock-agg--extract-params body :foo :bar)
|
||||
;; do something with foo and bar
|
||||
)"
|
||||
`(let ((body-wo-docstring (if (stringp (car-safe body)) (cdr body) body))
|
||||
(docstring (when (stringp (car-safe body)) (car-safe body))))
|
||||
`(let ((body-wo-docstring (if (stringp (car-safe ,body)) (cdr body) ,body))
|
||||
(docstring (when (stringp (car-safe ,body)) (car-safe ,body))))
|
||||
(while-let ((symbol (and
|
||||
(member (car-safe body-wo-docstring) ',params)
|
||||
(car-safe body-wo-docstring))))
|
||||
|
|
@ -358,8 +358,8 @@ manually after setting."
|
|||
params)
|
||||
(setq body-wo-docstring (cddr body-wo-docstring)))
|
||||
(if docstring
|
||||
(setq body (cons docstring body-wo-docstring))
|
||||
(setq body body-wo-docstring))))
|
||||
(setq ,body (cons docstring body-wo-docstring))
|
||||
(setq ,body body-wo-docstring))))
|
||||
|
||||
(cl-defmacro org-clock-agg-defgroupby (name &body body)
|
||||
"Define a grouping function for `org-clock-agg'.
|
||||
|
|
@ -388,6 +388,8 @@ sort function."
|
|||
(setq readable-name (symbol-name name)))
|
||||
`(progn
|
||||
(defun ,func-name (elem extra-params)
|
||||
;; XXX To silence the byte-compiler
|
||||
(ignore elem extra-params)
|
||||
,@body)
|
||||
(setf (alist-get ',name org-clock-agg-groupby-functions)
|
||||
'((:function . ,func-name)
|
||||
|
|
@ -696,7 +698,7 @@ TREE is a tree of alists as described in `org-clock-agg--groupby'."
|
|||
(alist-get :sort-order node))))
|
||||
(mapcar
|
||||
(lambda (grouped)
|
||||
(let ((group-symbol (nth 0 (car grouped)))
|
||||
(let (;; (group-symbol (nth 0 (car grouped)))
|
||||
(sort-symbol (nth 1 (car grouped)))
|
||||
(sort-order (nth 2 (car grouped))))
|
||||
(setf (cdr grouped)
|
||||
|
|
@ -769,7 +771,7 @@ TREE is a tree of alists as described in `org-clock-agg--groupby'."
|
|||
#'widget-create 'menu-choice
|
||||
:tag "Files"
|
||||
:value (alist-get :files org-clock-agg--params)
|
||||
:notify (lambda (widget &rest ignore)
|
||||
:notify (lambda (widget &rest _)
|
||||
(setf (alist-get :files org-clock-agg--params)
|
||||
(widget-value widget)))
|
||||
'(item :tag "Org Agenda" :value org-agenda)
|
||||
|
|
@ -793,7 +795,7 @@ TREE is a tree of alists as described in `org-clock-agg--groupby'."
|
|||
(if (numberp val)
|
||||
(number-to-string val)
|
||||
val))
|
||||
:notify (lambda (widget &rest ignore)
|
||||
:notify (lambda (widget &rest _)
|
||||
(let ((val (widget-value widget)))
|
||||
(when (string-match-p (rx bos (? "-") (+ digit) eos) val)
|
||||
(setq val (string-to-number val)))
|
||||
|
|
@ -806,7 +808,7 @@ TREE is a tree of alists as described in `org-clock-agg--groupby'."
|
|||
(if (numberp val)
|
||||
(number-to-string val)
|
||||
val))
|
||||
:notify (lambda (widget &rest ignore)
|
||||
:notify (lambda (widget &rest _)
|
||||
(let ((val (widget-value widget)))
|
||||
(when (string-match-p (rx bos (? "-") (+ digit) eos) val)
|
||||
(setq val (string-to-number val)))
|
||||
|
|
@ -823,7 +825,7 @@ TREE is a tree of alists as described in `org-clock-agg--groupby'."
|
|||
for sort-order-value in (alist-get :sort-order org-clock-agg--params)
|
||||
collect (list group-value sort-value sort-order-value))
|
||||
:notify
|
||||
(lambda (widget changed-widget &optional event)
|
||||
(lambda (widget _changed-widget &optional _event)
|
||||
(let ((group-value (mapcar #'car (widget-value widget)))
|
||||
(sort-value (mapcar #'cadr (widget-value widget)))
|
||||
(sort-order-value (mapcar #'caddr (widget-value widget))))
|
||||
|
|
@ -894,12 +896,12 @@ WIDGET is the instance of the widget that was changed."
|
|||
(org-clock-agg--render-extra-params)
|
||||
(insert "\n")
|
||||
(widget-create 'push-button
|
||||
:notify (lambda (&rest ignore)
|
||||
:notify (lambda (&rest _)
|
||||
(org-clock-agg-refresh))
|
||||
"Refresh")
|
||||
(insert " ")
|
||||
(widget-create 'push-button
|
||||
:notify (lambda (&rest ignore)
|
||||
:notify (lambda (&rest _)
|
||||
(org-clock-agg-generate-report))
|
||||
"Create function")
|
||||
(insert "\n\n")
|
||||
|
|
@ -960,7 +962,7 @@ NODE is one node of a tree, which is described in the function
|
|||
(org-element-property :raw-value (alist-get :headline elem))))))
|
||||
(widget-create 'push-button
|
||||
:elem elem
|
||||
:notify (lambda (widget &rest ignore)
|
||||
:notify (lambda (widget &rest _)
|
||||
(let ((elem (widget-get widget :elem)))
|
||||
(org-clock-agg--goto-elem elem)))
|
||||
:button-face 'org-clock-agg-elem-face
|
||||
|
|
@ -1075,7 +1077,7 @@ FROM and TO define the time range. Both are `org-ql' time predicates,
|
|||
that is a number of days (e.g. -7 for the last week) or a date
|
||||
parseable by `parse-time-string'.
|
||||
|
||||
FILES is either 'org-agenda, a key of `org-clock-agg-files-preset' (in
|
||||
FILES is either `org-agenda', a key of `org-clock-agg-files-preset' (in
|
||||
which case the value of that variable is used) or a list of files.
|
||||
|
||||
GROUPBY is a list of keys of `org-clock-agg-groupby-functions'. Each
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue