protesilaos / denote

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

Show entries in Calendar #389

Open x61 opened 4 months ago

x61 commented 4 months 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 4 months 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 3 months 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)))))
`
protesilaos commented 2 months ago

From: Jonathan Wilner @.***> Date: Tue, 20 Aug 2024 12:16:56 -0700

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.

Thank you for taking the time to find this!

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.

I will need more time to test this though. As I am expecting to release a new version of Denote in the coming days, this will have to be done later. If you or anyone else is willing to test things, then I am happy to include whatever findings.

-- Protesilaos Stavrou https://protesilaos.com

protesilaos commented 2 months ago

Hello folks! Just to note that I am interested to learn more about how to potentially highlight journal entries in the M-x calendar. The inclusion into the org-agenda-files is another option, though I think that is separate: it is probably more useful for some workflow that involves monthly/weekly/daily planning (which the user wants to maintain as standalone files).