bastibe / org-journal

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

Make `org-journal-new-entry` honor the full timestamp and not only the day #438

Open lhernanz opened 3 months ago

lhernanz commented 3 months ago

Is your feature request related to a problem? Please describe. Sometimes I create entries in some other file and I want to create a link in the journal when clocking out. But I want the entries to be place at the start of the event, not at the end, therefore I want to be able to create entries at specific points in the past.

Describe the solution you'd like Currently, org-journal-new-entry already supports a time parameter to create entries and specific points in the past. Unfortunately, only the day component of the time parameter is honored and the entry is created at the current time. If you are creating an entry of the same date, the time parameter does not have any practical effect (except in the corner case that you are extending the day)

Describe alternatives you've considered Implementing this change should be straightforward, at least of the case of the same day where no day extension is needed. You just need to add the time parameter to the following line https://github.com/bastibe/org-journal/blob/17b34ce8df9649a73b715c13698220bde1628668/org-journal.el#L768 and probably https://github.com/bastibe/org-journal/blob/17b34ce8df9649a73b715c13698220bde1628668/org-journal.el#L774

As these lines are in the middle of a function, it is difficult to get the desired behavior without redefining the function.

lhernanz commented 3 months ago

I am not sure why the preview is pointing at wrong lines, but the line numbers should be correct. To avoid any confusion the line to replace would be this

(format-time-string org-journal-time-format)

And it would need to be replaced with

(format-time-string org-journal-time-format time)