From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou 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 Message-ID: <87k1ladke0.fsf@nicolasgoaziou.fr> References: <1541377860.1107531.1565461832.5F447B5E@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gOWgb-000679-RH for emacs-orgmode@gnu.org; Sun, 18 Nov 2018 18:41:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gOWgW-00081y-OT for emacs-orgmode@gnu.org; Sun, 18 Nov 2018 18:41:05 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:56837) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gOWgW-000819-FQ for emacs-orgmode@gnu.org; Sun, 18 Nov 2018 18:41:00 -0500 In-Reply-To: <1541377860.1107531.1565461832.5F447B5E@webmail.messagingengine.com> (John Lee's message of "Mon, 05 Nov 2018 00:31:00 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Lee Cc: emacs-orgmode@gnu.org Hello, John Lee 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