bastibe / org-journal

A simple org-mode based journaling mode
BSD 3-Clause "New" or "Revised" License
1.24k stars 123 forks source link

org-journal-new-entry-from-agenda #347

Open holtzermann17 opened 3 years ago

holtzermann17 commented 3 years ago

Presently there's no way to add journal items for future dates directly from the *Org Agenda* buffer.

The following function frankensteins together ideas from other functions to create a solution:

(defun org-journal-new-entry-from-agenda (prefix)
  "Add journal entry for the date at point in the agenda."
  (interactive "P")
  (org-agenda-check-type t 'agenda)
  (let* ((day (or (get-text-property (min (1- (point-max)) (point)) 'day)
                  (user-error "Don't know which date to open in calendar")))
         (time (org-time-string-to-time (format-time-string "%Y-%m-%d" (org-time-from-absolute day)))))
    (org-journal-new-scheduled-entry prefix time)))

The current work around would be to press c j n to jump to the calendar and then insert a new journal item for that date. Nothing wrong with this, but I think having a standalone function that can be bound directly, as above, would be better.

bastibe commented 3 years ago

That's a cool idea!

If I'm reading your code correctly, it is meant to be invoked from within an agenda view, right? Is there a way to add a keyboard shortcut or something similar that is only available inside that agenda-view?