7

I'm using org-mode as a knowledge base, where each file is for a specific project that I'm working on.

Each file has its own journal and I would love to see an aggregated journal of all the things I've done.

That information is in a bunch of .org files in a specific directory.

The functionality I'm looking for is what the agenda timeline provides, but it only works for one file.

Is there a way to make it work for all files in org-agenda-files?

5
  • This seems a duplicate to the question Timelineview of all agenda files on unix.SE.
    – elemakil
    Commented Oct 8, 2014 at 21:17
  • You are right. Will there be an effort to try to migrate emacs questions from other SO? (I dont know if that is possible. I could help with said effort)
    – edmz
    Commented Oct 8, 2014 at 21:42
  • Emacs questions from Stack Overflow or Super User is, I think, the official policy on duplicate questions and migration. IMO, that other question is fine for migrating here since it's borderline on unix.SE and could probably get a better answer here. Commented Oct 8, 2014 at 22:27
  • 1
    @purple_arrows Regardless of policy, the question that elemakil linked to can't be migrated because it is way older than 60 days.
    – itsjeyd
    Commented Oct 8, 2014 at 22:35
  • @itsjeyd Doh! Of course. Thanks for pointing that out. Commented Oct 8, 2014 at 23:14

2 Answers 2

2

Based on the suggestions provided in this answer, the following command collects the contents of all org-agenda-files in a single file and then calls the org-agenda command that builds the timeline:

(defun org-agenda-timeline-all (&optional arg)
  (interactive "P")
  (with-temp-buffer
    (dolist (org-agenda-file org-agenda-files)
      (insert-file-contents org-agenda-file nil)
      (end-of-buffer)
      (newline))
    (write-file "/tmp/timeline.org")
    (org-agenda arg "L")))

For best results, set up a custom key binding for this command via

(define-key org-mode-map (kbd "C-c t") 'org-agenda-timeline-all)

Additionally, if you want the command to consider all org-mode files that are currently open (in addition your org-agenda-files, which may or may not be open), you can replace org-agenda-files with a call to (org-files-list) in the code above.

3
  • 1
    the problem with using org-agenda-files, is that if it is a directory, the code wont work.
    – edmz
    Commented Oct 9, 2014 at 15:52
  • @lal00 - replace org-agenda-files with (org-agenda-files t) to solve that problem. Commented Jan 30, 2015 at 3:33
  • The other problem with this approach is that you lack the reference back to the original .org file. I want to both know where a particular completed task came from, and also be able to navigate to that .org (or its archive) file. Commented Jan 30, 2015 at 3:34
1

It isn't quite identical to the timeline, but you can make a custom agenda view showing some time span in "log mode". By binding org-agenda-files locally in the the agenda command we can load whatever files we want without messing up the normal behavior. This does a week, change org-agenda-span to the number of days you want.

(defvar org-timeline-files nil
  "The files to be included in `org-timeline-all-files'. Follows
  the same rules as `org-agenda-files'")

(setq org-timeline-files '("/path/to/org/files/"))

(add-to-list 'org-agenda-custom-commands
             '("R" "Week in review"
                agenda ""
                ;; agenda settings
                ((org-agenda-span 'week)
                  (org-agenda-start-on-weekday 0) ;; start on Sunday
                  (org-agenda-overriding-header "Week in Review")
                  (org-agenda-files 
                    (let ((org-agenda-files org-timeline-files))
                          (org-agenda-files nil 'ifmode)))
                  (org-agenda-start-with-log-mode t)
                  (org-agenda-log-mode-items '(clock state))
                  (org-agenda-archives-mode t) ; include archive files
                )))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.