emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-habit: allow overriding org-scheduled-past-days and always i


From: Nicolas Goaziou
Subject: Re: [O] org-habit: allow overriding org-scheduled-past-days and always including time of day
Date: Mon, 19 Nov 2018 00:40:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello,

John Lee <address@hidden> writes:

> Here's a couple of patches that add new org-habit variables.  I hope
> the variable documentation describes them sufficiently: if not I need
> to change the docs so if you review these patches please read the
> patch before the rest of this email so that you're not "cheating"!

Thank you. Some comments follow.

> My own workflow around this is similar to GTD, so I'm using SCHEDULED
> as basically a way to get TODO items to show up after the scheduled
> date, not to show up in the calendar except as a reminder that I have
> new TODOs. For that reason I set org-scheduled-past-days to a low
> value (3 right now). I also set org-agenda-todo-ignore-scheduled to
> 'future and org-agenda-tags-todo-honor-ignore-options to t (not
> directly relevant here except as context). For habits that causes
> habits not to show up sometimes because of the short
> org-scheduled-past-days, which isn't appropriate for my habits: if
> I say .+5d, I still want to see the habit there if it's due, even if
> it's been 4 days since the last done date (which is more than the
> 3 days of org-scheduled-past-days). This motivates
> `org-habit-scheduled-past-days'.

It sounds reasonable.

> Similarly, since I want to do some of my habits at a particular time
> of day, org-agenda's omitting of the time of day from the scheduled
> timestamp if this is a "repeat" (i.e. I missed doing the habit) is
> unhelpful for habits, because now I have to scan though a long-ish
> list of habits (5 or 10 right now!) and think "is now the right time,
> should I have done that already?" for every habit in the list, rather
> than just eyeballing it to see which ones are around now in time. This
> motivates `org-habit-always-show-time'.

It sounds good too. However, I wonder if that shouldn't be the default.
Hiding the time for a missed scheduled item hadn't the habits in mind
(see http://lists.gnu.org/archive/html/emacs-orgmode/2016-11/msg00539.html).

To put it differently, is there any workflow wanting to hide the time
for habits in this case?

> I have not yet submitted the FSF copyright assignment form but am
> prepared to do so.

This can go as a TINYCHANGE (you need to put that string at the end of
the commit messages).

However, if you plan to be able to provide more code to Org, I suggest
starting the copyright assignment nonetheless.

> * lisp/org-habit.el: Add new variable `org-habit-scheduled-past-days'
>   to allow overriding `org-scheduled-past-days' for habits

It should simply be:

* lisp/org-habit.el (org-habit-scheduled-past-days): New variable.

>           (when (or (and (> ddays 0) (< diff ddays))
> -                   (> diff org-scheduled-past-days)
> +                   (> diff (if habitp
> +                               (or org-habit-scheduled-past-days
> +                                   org-scheduled-past-days)
> +                             org-scheduled-past-days))

Nitpick:

    (or (and habitp org-habit-scheduled-past-days)
        org-scheduled-past-days)

> +(defcustom org-habit-scheduled-past-days nil
> +  "Non-nil means the value of this variable will be used instead
> +of org-scheduled-past-days, for habits only.

First line needs to be a full sentence. Also,

  `org-scheduled-past-days'

> +Setting this to say 10000 is a way to make habits always show up
> +as a reminder, even if you set org-scheduled-past-days to a small

Ditto: `org-scheduled-past-days'.

> +value because you regard SCHEDULED items as a way of 'turning on'

scheduled items

"turning on"

> +TODO items on a particular date, rather than as a means of
> +creating calendar-based reminders."

as a mean of...

> +  :group 'org-habit
> +  :type 'integer)

You need to add :package-version and :safe keywords.

> * lisp/org-habit.el: Add new variable `org-habit-always-show-time'
>   to force always showing the time of day

See above.

> * lisp/org-agenda.el (org-agenda-get-scheduled): honour
>   `org-habit-always-show-time`
> ---
>  lisp/org-agenda.el | 12 +++++++++---
>  lisp/org-habit.el  | 10 ++++++++++
>  2 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index e2bd5cc2d..08e286730 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -6253,9 +6253,15 @@ scheduled items with an hour specification like 
> [h]h:mm."
>                  (head (buffer-substring (point) (line-end-position)))
>                  (time
>                   (cond
> -                  ;; No time of day designation if it is only
> -                  ;; a reminder.
> -                  ((and (/= current schedule) (/= current repeat)) nil)
> +                  ;; No time of day designation if it is only a
> +                  ;; reminder (unless org-habit-always-show-time
> +                  ;; forces display of the time of day
> +                  ;; designation).
> +                  ((and
> +                    (not (and habitp org-habit-always-show-time))
> +                    (/= current schedule)
> +                    (/= current repeat))
> +                   nil)

Per my suggestion, maybe (and (not habitp) ...) would be enough. WDYT?

> +(defcustom org-habit-always-show-time nil
> +  "Non-nil means always show the time of day designation from the
> +timestamp, even if the habit is past its due date.
> +Setting this to t is useful if you regard the time of day
> +designation in some of your habits' scheduled timestamps as a
> +guide to when to do the habit, rather than only a time after
> +which the habit is due."
> +  :group 'org-habit
> +  :type 'boolean)

If we keep this variable, please see suggestions above.

Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]