protesilaos / denote

Simple notes for Emacs with an efficient file-naming scheme
https://protesilaos.com/emacs/denote
GNU General Public License v3.0
487 stars 53 forks source link

Show entries in Calendar #389

Open x61 opened 1 month ago

x61 commented 1 month ago

With org-journal.el, your journal entry for the day are indicated in the calendar.el. I was thinking could we have denote notes show up in calendar as well? So if there is an entry for the day, there could be an indicator in the calendar that an entry was entered that day and perhaps, provide an option to list all entries for that day.

protesilaos commented 1 month ago

From: x61 @.***> Date: Sun, 7 Jul 2024 03:00:29 -0700

With org-journal.el, your journal entry for the day are indicated in the calendar.el.

Can you tell me more about this, as I am unfamiliar with the workflow. Does it apply a highlight to the given day? Does it do more with that, such as somehow preview the entry for that day? If there are many entries, does it show a buffer with their titles or something?

I was thinking could we have denote notes show up in calendar as well? So if there is an entry for the day, there could be an indicator in the calendar that an entry was entered that day and perhaps, provide an option to list all entries for that day.

I need to think about this based on your feedback. We will need to work with calendar.el, which is not something we are doing right now. Perhaps this is best done as a standalone package, instead of an extension to the existing files we have here. Though we will see.

-- Protesilaos Stavrou https://protesilaos.com

jonathanwilner commented 5 days ago

This is the code from org-journal that does it. It just adds the file to org-agenda-files. Considering that the use case is based on org-journal. restricting this to org-mode & org-agenda seems OK vs. a broader calendar.el / diary approach.

I believe this can be done right now via user-specific emacs lisp. It would certainly be cool to have it out-of-the-box from Denote, especially if it's linked to a specific silo or silos.



(defun org-journal--update-org-agenda-files ()
  "Adds the current and future journal files to `org-agenda-files'
containing TODOs, and cleans out past org-journal files."
  (when org-journal-enable-agenda-integration
    (let ((not-org-journal-agenda-files
           (seq-filter
            (lambda (fname)
              (not (string-match (org-journal--dir-and-file-format->pattern) fname)))
            (org-agenda-files)))
          (org-journal-agenda-files
           (let* ((future (org-journal--read-period 'future))
                  (beg (car future))
                  (end (cdr future)))
             (setcar (cdr beg) (1- (cadr beg))) ;; Include today; required for `org-journal--search-build-file-list'
             (when (< (nth 2 (decode-time (current-time))) org-extend-today-until)
               (setq beg (decode-time (apply #'encode-time `(0 59 -1 ,(nth 1 beg) ,(nth 0 beg) ,(nth 2 beg))))
                     beg (list (nth 4 beg) (nth 3 beg) (nth 5 beg))))
             (org-journal--search-build-file-list
              (org-journal--calendar-date->time beg)
              (org-journal--calendar-date->time end)))))
      (org-store-new-agenda-file-list (append not-org-journal-agenda-files
                                              org-journal-agenda-files)))))
`