emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: John Lee <jjl@pobox.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-habit: allow overriding org-scheduled-past-days and always including time of day
Date: Mon, 19 Nov 2018 00:40:55 +0100	[thread overview]
Message-ID: <87k1ladke0.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <1541377860.1107531.1565461832.5F447B5E@webmail.messagingengine.com> (John Lee's message of "Mon, 05 Nov 2018 00:31:00 +0000")

Hello,

John Lee <jjl@pobox.com> 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

  parent reply	other threads:[~2018-11-18 23:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05  0:31 org-habit: allow overriding org-scheduled-past-days and always including time of day John Lee
2018-11-05 13:01 ` [PATCH] " John Lee
2018-11-18 23:40 ` Nicolas Goaziou [this message]
2019-02-02 18:50   ` John Lee
2019-02-02 21:45     ` Nicolas Goaziou
2019-02-03 15:53   ` John Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1ladke0.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jjl@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).