all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [QUESTION] How to generate org-agenda view for clocked tasks and logs etc which are sorted by timestamps?
@ 2021-11-04  4:16 stardiviner
  2021-11-04 15:03 ` Russell Adams
  0 siblings, 1 reply; 5+ messages in thread
From: stardiviner @ 2021-11-04  4:16 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

How to use elisp code to generate an org-agenda view for clocked tasks and
logs etc which are sorted by timestamps? I want to view my daily done tasks
and attach them as part of diary (maybe use org source block elisp code to
generate output?)

So how to setup `org-agenda-custom-commands` to archive this purpose?

Thanks for your help in advance. Regards.


[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

[-- Attachment #2: Type: text/html, Size: 1430 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [QUESTION] How to generate org-agenda view for clocked tasks and logs etc which are sorted by timestamps?
  2021-11-04  4:16 [QUESTION] How to generate org-agenda view for clocked tasks and logs etc which are sorted by timestamps? stardiviner
@ 2021-11-04 15:03 ` Russell Adams
  2021-11-05 11:20   ` Christopher M. Miles
  0 siblings, 1 reply; 5+ messages in thread
From: Russell Adams @ 2021-11-04 15:03 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Nov 04, 2021 at 12:16:19PM +0800, stardiviner wrote:
> How to use elisp code to generate an org-agenda view for clocked tasks and
> logs etc which are sorted by timestamps? I want to view my daily done tasks
> and attach them as part of diary (maybe use org source block elisp code to
> generate output?)
>
> So how to setup `org-agenda-custom-commands` to archive this purpose?

I routinely export my agenda to HTML with logbook mode enabled and
inactive timestamps. This shows a complete timeline of my actions.  I
save timestamps on changing TODO to DONE, use active timestamps for
appointments, and I constantly add inactive timestamps while taking
notes. I use this to justify billing to clients.

I open the agenda, v m to make a monthly view, L for logbook, ] to
enable inactive timestamps, and then C-x C-w to save. You may be able
to just use elisp to trigger these actions.

I don't do it often enough to automate it. I love being able to
flatten my tree of notes into a timeline this way.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [QUESTION] How to generate org-agenda view for clocked tasks and logs etc which are sorted by timestamps?
  2021-11-04 15:03 ` Russell Adams
@ 2021-11-05 11:20   ` Christopher M. Miles
  2021-11-05 11:53     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher M. Miles @ 2021-11-05 11:20 UTC (permalink / raw)
  To: Russell Adams; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2563 bytes --]



Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Thu, Nov 04, 2021 at 12:16:19PM +0800, stardiviner wrote:
>> How to use elisp code to generate an org-agenda view for clocked tasks and
>> logs etc which are sorted by timestamps? I want to view my daily done tasks
>> and attach them as part of diary (maybe use org source block elisp code to
>> generate output?)
>>
>> So how to setup `org-agenda-custom-commands` to archive this purpose?
>
> I routinely export my agenda to HTML with logbook mode enabled and
> inactive timestamps. This shows a complete timeline of my actions.  I
> save timestamps on changing TODO to DONE, use active timestamps for
> appointments, and I constantly add inactive timestamps while taking
> notes. I use this to justify billing to clients.
>
> I open the agenda, v m to make a monthly view, L for logbook, ] to
> enable inactive timestamps, and then C-x C-w to save. You may be able
> to just use elisp to trigger these actions.
>
> I don't do it often enough to automate it. I love being able to
> flatten my tree of notes into a timeline this way.
>
> ------------------------------------------------------------------
> Russell Adams                            RLAdams@AdamsInfoServ.com
>
> PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>
> Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

Russell, Thanks for your hint.

I have a prototype code now, but still have problem.

#+begin_src emacs-lisp
(add-to-list
 'org-agenda-custom-commands
 '("c" "Tody [c]locked tasks."
   ((agenda ""
            ((org-agenda-ndays 1)
             (org-agenda-span-1)
             (org-agenda-use-time-grid t)
             (org-agenda-include-diary nil)
             (org-agenda-show-log (quote clockcheck))
             (org-agenda-clockreport t))))))
#+end_src

#+begin_src emacs-lisp
(let* ((org-agenda-sticky t)
       ;; FIXME how to run it in background instead of switch to agenda buffer.
       (_ (org-agenda nil "c"))
       (origin-buffer (current-buffer))
       (origin-buffer-point (point))
       (agenda-buffer (with-current-buffer "*Org Agenda(c)*"
                        (buffer-substring (point-min) (point-max)))))
  (switch-to-buffer origin-buffer)
  (with-current-buffer origin-buffer
    (goto-char origin-buffer-point)
    (insert agenda-buffer)))
#+end_src

In the source code comment "FIXME" org-agenda always in frontend and popup buffer. I can't generate
org-agenda in background then get the buffer content.

Does anybody knows some tricky method for my code?



[-- Attachment #1.2: Type: text/html, Size: 6827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 282 bytes --]


<#secure method=pgpmime mode=sign>
-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [QUESTION] How to generate org-agenda view for clocked tasks and logs etc which are sorted by timestamps?
  2021-11-05 11:20   ` Christopher M. Miles
@ 2021-11-05 11:53     ` Ihor Radchenko
  2021-11-05 14:36       ` [SOLVED] " Christopher M. Miles
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2021-11-05 11:53 UTC (permalink / raw)
  To: numbchild; +Cc: emacs-orgmode

"Christopher M. Miles" <numbchild@gmail.com> writes:

> In the source code comment "FIXME" org-agenda always in frontend and popup buffer. I can't generate
> org-agenda in background then get the buffer content.
>
> Does anybody knows some tricky method for my code?

Maybe wrap agenda call into save-window-excursion?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [SOLVED] Re: [QUESTION] How to generate org-agenda view for clocked tasks and logs etc which are sorted by timestamps?
  2021-11-05 11:53     ` Ihor Radchenko
@ 2021-11-05 14:36       ` Christopher M. Miles
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher M. Miles @ 2021-11-05 14:36 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2447 bytes --]


Ihor Radchenko <yantar92@gmail.com> writes:

> "Christopher M. Miles" <numbchild@gmail.com> writes:
>
>> In the source code comment "FIXME" org-agenda always in frontend and popup buffer. I can't generate
>> org-agenda in background then get the buffer content.
>>
>> Does anybody knows some tricky method for my code?
>
> Maybe wrap agenda call into save-window-excursion?

Thanks for your helpful hint. I finally got a solution:

#+begin_src emacs-lisp
(add-to-list
 'org-agenda-custom-commands
 '("c" "Tody [c]locked tasks."
   ((agenda ""
            ((org-agenda-ndays 1)
             (org-agenda-span-1)
             (org-agenda-use-time-grid t)
             (org-agenda-include-diary nil)
             (org-agenda-show-log (quote clockcheck))
             (org-agenda-clockreport t))))))

(let* ((org-agenda-sticky t)
       ;; Run it in background instead of switch to agenda buffer with `save-window-excursion'.
       (_ (save-window-excursion (org-agenda nil "c")))
       (origin-buffer (current-buffer))
       (origin-buffer-point (point))
       (agenda-buffer (with-current-buffer "*Org Agenda(c)*"
                        (buffer-substring (point-min) (point-max)))))
  (print agenda-buffer))
#+end_src

#+RESULTS[(2021-11-05 21:27:30) 96280334f709aece114a7bf308c1ff4762eff1bf]:
#+begin_example
Day-agenda (W44):
Friday      5 November 2021
                  8:00am......  ----------------
                 10:00am......  ----------------
                 12:00pm......  ----------------
   Feature        1:00pm- 1:04pm  Clocked:   (0:04) FEATURE [#A] create an org-agenda like view mode for clocking,note logs sorted by timestamps
   Feature        1:06pm- 1:38pm  Clocked:   (0:32) FEATURE [#A] create an org-agenda like view mode for clocking,note logs sorted by timestamps
                  2:00pm......  ----------------
                  4:00pm......  ----------------
                  6:00pm......  ----------------
                  6:28pm......  now - - - - - - - - - - - - - - - - - - - - - - - - -
                  8:00pm......  ----------------
#+end_example

So that I can record those into into Diary.


-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-05 14:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-04  4:16 [QUESTION] How to generate org-agenda view for clocked tasks and logs etc which are sorted by timestamps? stardiviner
2021-11-04 15:03 ` Russell Adams
2021-11-05 11:20   ` Christopher M. Miles
2021-11-05 11:53     ` Ihor Radchenko
2021-11-05 14:36       ` [SOLVED] " Christopher M. Miles

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.