bastibe / org-journal

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

Add option to disable scheduled entries having a time #389

Closed tostr7191 closed 2 years ago

tostr7191 commented 2 years ago

When I am scheduling entries, I never use time. Basically my scheduling is based around days, but I don't work on the granularity of hours/minutes.

In org-journal, even if I don't enter any time (say for example I just put in +2d in org-agenda), it will add a timestamp showing 00:00. And no matter how I look at it, that timestamp does not seem super useful to me.

What I get is this:

** TODO todo with time
<2022-04-17 Sun 00:00>

What I want is this:

** TODO todo without time
<2022-04-17 Sun>

I am very new to emacs (coming from neovim) and am not very smart at doing things the emacs way, but I played around a bit with the function for creating scheduled events and came up with this:

;; this needs to be set to either t or nil
(setq org-journal-schedule-include-time t)

(defun patch/org-journal-new-scheduled-entry (prefix &optional scheduled-time)
  "Create a new entry in the future with an active timestamp.
With non-nil prefix argument create a regular entry instead of a TODO entry."
  (interactive "P")
  (let ((time (or scheduled-time (org-time-string-to-time (org-read-date nil nil nil "Date:"))))
        org-journal-carryover-items)
    (when (time-less-p time (current-time))
      (user-error "Scheduled time needs to be in the future"))
    (org-journal-new-entry nil time)
    (unless prefix
      (insert "TODO "))
    (save-excursion
      (insert "\n")
      ;; only change is this line to make use of the variable
      (org-insert-time-stamp time org-journal-schedule-include-time))))

This works in my testing, I was wondering if there is any interest in this feature in general, something that could/would be merged maybe? I can ofc. create a PR if needed.

Best, tostr

bastibe commented 2 years ago

If you find it useful, I'm sure other people will find it useful, too! I'd be happy about a pull request that adds this as an option.

tostr7191 commented 2 years ago

PR is in #390. Closing this issue. Thanks @bastibe !