emacsomancer / org-daily-reflection

Reflect on your org-roam daily entries, comparing N org-roam dailies at M intervals (years, months, fortnights, weeks, days).
GNU General Public License v3.0
19 stars 1 forks source link

[[./images/n-year-diary.jpg]]

You can use Org Daily Reflection like one does with a paper three- or five-year diary, to see what was happening on this day last year, and the year prior, &c.

[[./images/5-years.png][./images/5-years.png]]

But you could also look at the last three days of daily journals...

[[./images/3-days.png][./images/3-days.png]]

...or dailies at other specified intervals (e.g. days, weeks, fortnights, months, years, [decades], [centuries]). (E.g., "show me 7 dailies at weekly intervals"; "show me 4 dailies at monthly intervals", &c.)

A general interactive interface can be accessed via the command =org-daily-reflect=, which will ask the user for a time-span (e.g. "year") and an integer range ("3"). When called non-interactively, it also be passed a span and range number (e.g., =(org-daily-reflect 'year 3)=, to get dailies comparing this day on the preceding three years.)

A few sample one-shot functions with prefix =org-reflect-on-last-= are included as well (e.g. =org-reflect-on-last-five-days= to see the preceding five days of org-roam dailies). The user can create new functions or commands using these models for their desired reflections.

** Version 0.033 additional functionality

** Details and Customisation Org Daily Reflect does not, in fact, actually require the Org-roam package, so it should be able to be used with other daily journal systems (certainly with [[https://github.com/meedstrom/org-node][Org Node]] (which I use) and probably with [[https://protesilaos.com/emacs/denote][Denote]]). Currently it relies on being told a directory which contains Org files which are all of the form =.org=. (E.g., =2021-12-29.org=, =2024-08-05=, &c.) See below, esp. the "TODO" notes for more information.

This package /optionally/ uses =org-roam-dailies--capture= to open (actual or potential) daily journal entries, but it will still work without it. And even some users who do have Org Roam installed may prefer to turn off =org-daily-reflection-capture-nascent-files= (which will disable the call to =org-roam-dailies--capture=) in order to not create new potential journal entries for missing dates (though when =org-dailies--capture= is utilised, any non-previously existing journal entries are marked as "unmodified" so they will not trigger any "unsaved file" warnings). (When =org-daily-reflection-capture-nascent-files= is set to =nil=, or =org-roam-dailies--capture= is unavailable, it will instead just insert "missing journal entry" notes in the appropriate window.)

It also tries setting the location it uses for looking up dailies (set in =org-daily-reflection-dailies-directory=) to the value of =org-roam-dailies-directory=, but this variable can be manually set.

One issue (in its current beta state) is that it assumes that the journal entries are all in the directory specified in =org-daily-reflection-dailies-directory= and are named =.org= (e.g., =2024-08-01.org=). Though, since this is really its main requirement (it doesn't need org-ids &c.), it should be fairly flexible/portable. Being able to customise the expected file naming is a planned feature, although there are limitations in the current form as it relies on the file-name somehow denoting day, month, and year.

Check =customize= for various other options, including direction of window splits, whether leap days have special behaviour, whether or not the capture template is used to create potential (but marked unmodified) journal entries for dates without current journal entries (this only works if org-roam is available and can be disabled in any case), and (if org-roam capture templates are used) if a capture key is passed to the =org-roam-dailies--capture= function.

The default time spans are "day", "week", "fortnight", "month", and "year", but this can be customised, and it will also recognise "decade" and "century", though this is likely of little use to most users as Org-roam was first released in 2020, (and Org-mode itself only in 2003), but potentially users might have "back-created" entries pre-dating Org-roam (or Org, or their own births). (Org-mode seems to hard-fail for dates before January 1, 100, so BCE dates certainly won't work currently.)

[[./images/5-centuries.png][./images/5-centuries.png]]

** Installation Not yet on MELPA or similar.

You can manually clone/download and =require=, or install with an alternative/enhanced package manager, like [[https://github.com/progfolio/elpaca][elpaca]]:

+begin_src elisp

(use-package org-daily-reflection :ensure (:host github :repo "emacsomancer/org-daily-reflection"))

+end_src

or [[https://github.com/slotThe/vc-use-package][vc-use-package]] (probably the lightest-weight option):

+begin_src elisp

(use-package org-daily-reflection :vc (:fetcher github :repo "emacsomancer/org-daily-reflection"))

+end_src

or [[https://github.com/quelpa/quelpa][quelpa]]:

+begin_src elisp

(use-package org-daily-reflection :quelpa (org-daily-reflection :fetcher github :repo "emacsomancer/org-daily-reflection"))

+end_src

or [[https://github.com/radian-software/straight.el][straight]]:

+begin_src elisp

(use-package org-daily-reflection :straight (org-daily-reflection :type git :host github :repo "emacsomancer/org-daily-reflection"))

+end_src

** TODO *** Filename customisation In its present state, Org Daily Reflection it relies on being told a directory which contains Org files which are all of the form =.org=. (E.g., =2021-12-29.org=, =2024-08-05=, &c.), so the filename format is currently hard-coded, but future revisions may allow for other formats (though the filename would somehow).

One addition question here is possibly handling "supra-dailies", i.e., the case where a user has multiple separate files for a single day (maybe representing hour-minute-second timestamps). Handling examining filenames with additional information is not itself an issue here, but it is not clear what should be shown in the split windows in this case. Potentially windows could be split both vertically and horizontally, and one of the splits could contain all (or as many as will fit?) of the sub-day divisions. (I'm not currently planning on tackling this as I don't know of people with this approach, but if there are, it would be an interesting problem to ponder.)

*** Single-file datetrees Since this is not necessarily tied to Org-roam, it could also handle other daily journal type setups, including single-file note [[https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-datetree.el][Org-mode datetrees]]. [[https://www.reddit.com/r/emacs/comments/1einc51/org_roam_daily_reflection_a_new_package_for/lgdj7vt/][Apparently one user]] has managed to modify it accordingly, but I would like to include this as built-in package functionality

*** Compatibility with other Org(ish) setups (Denote, Org-Node) I would like to see if Org Daily Reflection in its current state can be used with Denote. (And possibly other non-Org-roam but Org-related Emacs multi-file note-taking setups?)

I am current user of Org Node, which itself is currently compatible with Org-roam, and plan for Org Daily Reflection to maintain compatibility with Org Node, and also to add additional optional feature to take advantage of Org Node features, such as specifying a series to query rather than looking at a directory. This should be faster on devices with potential high cost to filesystem access (not pointing fingers, but Android) and also allow for reflection on other types of series.

** Notes Paper multi-year diary image from [[https://memoryholevintage.com/products/handwritten-1936-1940-five-year-diary-journal-of-ethel-g-taylor-keene-nh][Handwritten 1936-1940 Five Year Diary Journal of Ethel G. Taylor, Keene, NH]].