mirror of
https://github.com/SqrtMinusOne/org-clock-agg.git
synced 2025-12-10 14:03:02 +03:00
org-clock-agg: add org-clock-agg-view-elems-at-point
This commit is contained in:
parent
4cc610315b
commit
8d24bb4ce7
2 changed files with 32 additions and 6 deletions
|
|
@ -106,6 +106,9 @@ Ensure to use =setopt= to set the variables; otherwise, the customization logic
|
||||||
|
|
||||||
Refer also to [[*Custom grouping predicates][custom grouping predicates]].
|
Refer also to [[*Custom grouping predicates][custom grouping predicates]].
|
||||||
|
|
||||||
|
** Commands in the interactive buffer
|
||||||
|
Press =E= (or =M-x org-clock-agg-view-elems-at-point=) on a tree element to view the constituent headings. =org-ql= is used to render the heading list.
|
||||||
|
|
||||||
* Customization
|
* Customization
|
||||||
** Node Formatting
|
** Node Formatting
|
||||||
The =org-clock-agg-node-format= variable determines the formatting of individual tree nodes. This uses a [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Custom-Format-Strings.html][format string]] that with the following format specifiers avaiable:
|
The =org-clock-agg-node-format= variable determines the formatting of individual tree nodes. This uses a [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Custom-Format-Strings.html][format string]] that with the following format specifiers avaiable:
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,10 @@ Refer to `format-seconds' for the available format specifiers."
|
||||||
:group 'org-clock-agg)
|
:group 'org-clock-agg)
|
||||||
|
|
||||||
(defcustom org-clock-agg-files-preset nil
|
(defcustom org-clock-agg-files-preset nil
|
||||||
"Presets for the \"files\" parameter in `org-clock-agg' views."
|
"Presets for the \"files\" parameter in `org-clock-agg' views.
|
||||||
|
|
||||||
|
The variable is an alist with preset names as keys and lists of
|
||||||
|
file names as values."
|
||||||
:type '(alist :key-type string :value-type (repeat string))
|
:type '(alist :key-type string :value-type (repeat string))
|
||||||
:group 'org-clock-agg)
|
:group 'org-clock-agg)
|
||||||
|
|
||||||
|
|
@ -842,11 +845,13 @@ TREE is a tree of alists as described in `org-clock-agg--groupby'."
|
||||||
(let ((keymap (make-sparse-keymap)))
|
(let ((keymap (make-sparse-keymap)))
|
||||||
(define-key keymap (kbd "q") #'org-clock-agg-quit)
|
(define-key keymap (kbd "q") #'org-clock-agg-quit)
|
||||||
(define-key keymap (kbd "r") #'org-clock-agg-refresh)
|
(define-key keymap (kbd "r") #'org-clock-agg-refresh)
|
||||||
|
(define-key keymap (kbd "E") #'org-clock-agg-view-elems-at-point)
|
||||||
(define-key keymap (kbd "<tab>") #'outline-toggle-children)
|
(define-key keymap (kbd "<tab>") #'outline-toggle-children)
|
||||||
(when (fboundp 'evil-define-key*)
|
(when (fboundp 'evil-define-key*)
|
||||||
(evil-define-key* 'normal keymap
|
(evil-define-key* 'normal keymap
|
||||||
"q" #'org-clock-agg-quit
|
"q" #'org-clock-agg-quit
|
||||||
"gr" #'org-clock-agg-refresh
|
"gr" #'org-clock-agg-refresh
|
||||||
|
"E" #'org-clock-agg-view-elems-at-point
|
||||||
(kbd "<tab>") #'outline-toggle-children))
|
(kbd "<tab>") #'outline-toggle-children))
|
||||||
keymap))
|
keymap))
|
||||||
|
|
||||||
|
|
@ -1122,11 +1127,13 @@ elements as well. LEVEL is the level of the node."
|
||||||
org-clock-agg-duration-format
|
org-clock-agg-duration-format
|
||||||
(alist-get :total (cdr node)))
|
(alist-get :total (cdr node)))
|
||||||
'face 'org-clock-agg-duration-face)))))
|
'face 'org-clock-agg-duration-face)))))
|
||||||
(insert (format-spec
|
(insert (propertize
|
||||||
(org-clock-agg--process-format-spec
|
(format-spec
|
||||||
org-clock-agg-node-format
|
(org-clock-agg--process-format-spec
|
||||||
`((title-width . ,title-width)))
|
org-clock-agg-node-format
|
||||||
spec)
|
`((title-width . ,title-width)))
|
||||||
|
spec)
|
||||||
|
'node node)
|
||||||
"\n")
|
"\n")
|
||||||
(when show-elems
|
(when show-elems
|
||||||
(org-clock-agg-render-tree-node-elems node)))
|
(org-clock-agg-render-tree-node-elems node)))
|
||||||
|
|
@ -1134,6 +1141,22 @@ elements as well. LEVEL is the level of the node."
|
||||||
(org-clock-agg--render-tree-node child show-elems (1+ level)))
|
(org-clock-agg--render-tree-node child show-elems (1+ level)))
|
||||||
(alist-get :children (cdr node))))
|
(alist-get :children (cdr node))))
|
||||||
|
|
||||||
|
(defun org-clock-agg-view-elems-at-point ()
|
||||||
|
"View elements of the `org-clock-agg' node at point."
|
||||||
|
(interactive)
|
||||||
|
(let ((node-at-point (get-text-property (point) 'node)))
|
||||||
|
(unless node-at-point
|
||||||
|
(user-error "No node at point!"))
|
||||||
|
(let* ((elems (org-clock-agg--ungroup (list node-at-point)))
|
||||||
|
(strings (mapcar (lambda (elem)
|
||||||
|
(org-ql-view--format-element
|
||||||
|
(alist-get :headline elem)))
|
||||||
|
elems)))
|
||||||
|
(org-ql-view--display
|
||||||
|
:buffer "*org-clock-agg-elems*"
|
||||||
|
:header (format "Elements: %s" (car node-at-point))
|
||||||
|
:strings strings))))
|
||||||
|
|
||||||
(defun org-clock-agg--parse-files (files)
|
(defun org-clock-agg--parse-files (files)
|
||||||
"Return a list of files to use in the `org-clock-agg' buffer.
|
"Return a list of files to use in the `org-clock-agg' buffer.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue