Re: [O] [PATCH 1/3] org-habit: Add org-habit-scheduled-past-days

2019-02-08 Thread John Lee
On Thu, 7 Feb 2019, at 21:27, John Lee wrote:
> On Wed, 6 Feb 2019, at 21:32, Nicolas Goaziou wrote:
> > I applied them in master. Thank you.
> 
> Thank you!
> 
> > Could you provide an entry for ORG-NEWS file, too?

Attached.
From ded5296358ec2bcfbe58a662b5112226298bf43f Mon Sep 17 00:00:00 2001
From: John Lee 
Date: Fri, 8 Feb 2019 23:13:01 +
Subject: [PATCH] Add to ORG-NEWS for recent org-habit changes

---
 etc/ORG-NEWS | 25 +
 1 file changed, 25 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index bf14412fd..595d1895c 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,16 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 * Version 9.3
 
 ** Incompatible changes
+*** org-agenda now always shows the time of day for ~org-habit~ habits
+
+Scheduled items with an associated time of day don't normally show the
+time in the agenda if they were missed, because they're regarded as
+only a reminder of a specific appointment that was already missed.
+That behaviour is unchanged, except for scheduled items that represent
+~org-habit~ habits, which now always show any time designation,
+because the time of a habit is regarded as the time when the habit
+should be done, even if one repeat was missed.
+
 *** ob-clojure will not auto prepend ~(ns ..)~ statement now
 When tangling, user usually just want to tangle literally code instead
 of prepend inserting a ~(ns ..)~ statement before source block
@@ -54,6 +64,16 @@ alternative was removed and there is no more a :use-xcolor options
 since now it's implicitly always true.
 
 ** New features
+*** Support showing missed habits when ~org-scheduled-past-days~ is in effect
+
+This supports GTD-style workflows in which scheduled items are used as
+a way of "turning on" TODO items on a particular date, rather than as
+a means of creating calendar-based reminders to do tasks.  It was
+possible to achieve that using ~org-scheduled-past-days~, but that
+caused some habits to not be shown when it was time to do the habit.
+~org-habit-scheduled-past-days~ overrides that variable just for
+~org-habit~ items.
+
 *** Handle overlay specification for notes in Beamer export
 
 This aligns Beamer notes with slide overlays.
@@ -136,6 +156,11 @@ dynamic block in ~org-dynamic-block-alist~.
 It was unused throughout the code base.
 
 ** Miscellaneous
+*** Use face ~org-agenda-done~ for habits scheduled for future
+
+This has the effect that if you just did the habit, it is "greyed out"
+in the agenda (given appropriate face configuration).
+
 *** No more special indentation for description items
 
 Descriptions items are indented like regular ones, i.e., text starts
-- 
2.17.1



Re: [O] [PATCH 1/3] org-habit: Add org-habit-scheduled-past-days

2019-02-07 Thread John Lee
On Wed, 6 Feb 2019, at 21:32, Nicolas Goaziou wrote:
> I applied them in master. Thank you.

Thank you!

> Could you provide an entry for ORG-NEWS file, too?

Will do.



Re: [O] Closing a task yesterday (or changing the day cutoff to 4am)

2019-02-03 Thread John Lee
Also see variable org-use-effective-time

On Sat, 2 Feb 2019, at 15:30, Leo Gaspard wrote:
> Uwe Koloska  writes:
> > Maybe the variable 'org-extend-today-until' can help.
> 
> Indeed, thank you!
> 



Re: [O] [PATCH 1/3] org-habit: Add org-habit-scheduled-past-days

2019-02-03 Thread John Lee
OK I guess in fact I'm 1. supposed to attach the patches (?) and 2. they 
contain hashes so I guess I should reattach them all together, having changed 
the first.  Here they are.  Sorry, I'm new to this email workflow.

The new thing here since Nicolas reviewed this last year (apart from applying 
changes in response to review feedback) is "greying out" habits that you just 
did, by applying face 'org-agenda-done when a habit is scheduled for the future.

On Sun, 3 Feb 2019, at 16:03, John Lee wrote:
> * lisp/org-habit.el (org-habit-scheduled-past-days): New variable
> 
> * lisp/org-agenda.el (org-agenda-get-scheduled): override
>   `org-scheduled-past-days' for habits if
>   `org-habit-scheduled-past-days` is not nil
> 
> TINYCHANGE
> ---
>  lisp/org-agenda.el |  4 +++-
>  lisp/org-habit.el  | 15 +++
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 489ecec95..784a555a9 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -90,6 +90,7 @@
>  (defvar org-habit-show-habits)
>  (defvar org-habit-show-habits-only-for-today)
>  (defvar org-habit-show-all-today)
> +(defvar org-habit-scheduled-past-days)
>  
>  ;; Defined somewhere in this file, but used before definition.
>  (defvar org-agenda-buffer-name "*Org Agenda*")
> @@ -6201,7 +6202,8 @@ scheduled items with an hour specification like 
> [h]h:mm."
>  habitp
>  (bound-and-true-p org-habit-show-all-today))
>   (when (or (and (> ddays 0) (< diff ddays))
> -   (> diff org-scheduled-past-days)
> +   (> diff (or (and habitp org-habit-scheduled-past-days)
> +   org-scheduled-past-days))
> (> schedule current)
> (and (/= current schedule)
>  (/= current today)
> diff --git a/lisp/org-habit.el b/lisp/org-habit.el
> index af4520729..88df38ce0 100644
> --- a/lisp/org-habit.el
> +++ b/lisp/org-habit.el
> @@ -89,6 +89,21 @@ It will be green even if it was done after the deadline."
>:group 'org-habit
>:type 'boolean)
>  
> +(defcustom org-habit-scheduled-past-days nil
> +"Value to use instead of `org-scheduled-past-days', for habits only.
> +
> +If nil, `org-scheduled-past-days' is used.
> +
> +Setting this to say 1 is a way to make habits always show up
> +as a reminder, even if you set `org-scheduled-past-days' to a
> +small value because you regard scheduled items as a way of
> +\"turning on\" TODO items on a particular date, rather than as a
> +means of creating calendar-based reminders."
> +  :group 'org-habit
> +  :type '(choice integer (const nil))
> +  :package-version '(Org . "9.3")
> +  :safe (lambda (v) (or (integerp v) (null v))))
> +
>  (defface org-habit-clear-face
>'background light)) (:background "#8270f9"))
>  (((background dark)) (:background "blue")))
> -- 
> 2.17.1
> 
> 
From 81a56b4b2fd8bfa92695a8386158f6e03584f948 Mon Sep 17 00:00:00 2001
From: John Lee 
Date: Sun, 3 Feb 2019 12:35:39 +
Subject: [PATCH 1/3] org-habit: Add org-habit-scheduled-past-days

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

* lisp/org-agenda.el (org-agenda-get-scheduled): override
  `org-scheduled-past-days' for habits if
  `org-habit-scheduled-past-days` is not nil

TINYCHANGE
---
 lisp/org-agenda.el |  4 +++-
 lisp/org-habit.el  | 15 +++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 489ecec95..784a555a9 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -90,6 +90,7 @@
 (defvar org-habit-show-habits)
 (defvar org-habit-show-habits-only-for-today)
 (defvar org-habit-show-all-today)
+(defvar org-habit-scheduled-past-days)
 
 ;; Defined somewhere in this file, but used before definition.
 (defvar org-agenda-buffer-name "*Org Agenda*")
@@ -6201,7 +6202,8 @@ scheduled items with an hour specification like [h]h:mm."
 		   habitp
 		   (bound-and-true-p org-habit-show-all-today))
 	(when (or (and (> ddays 0) (< diff ddays))
-		  (> diff org-scheduled-past-days)
+		  (> diff (or (and habitp org-habit-scheduled-past-days)
+  org-scheduled-past-days))
 		  (> schedule current)
 		  (and (/= current schedule)
 			   (/= current today)
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index af4520729..88df38ce0 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -89,6 +89,21 @@ It will be green even if it was done after the deadline."
   :group 'org-habit
   :type 'boolean)
 
+(defcustom org-habit-scheduled-past-days nil
+"V

[O] [PATCH 1/3] org-habit: Add org-habit-scheduled-past-days

2019-02-03 Thread John Lee
* lisp/org-habit.el (org-habit-scheduled-past-days): New variable

* lisp/org-agenda.el (org-agenda-get-scheduled): override
  `org-scheduled-past-days' for habits if
  `org-habit-scheduled-past-days` is not nil

TINYCHANGE
---
 lisp/org-agenda.el |  4 +++-
 lisp/org-habit.el  | 15 +++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 489ecec95..784a555a9 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -90,6 +90,7 @@
 (defvar org-habit-show-habits)
 (defvar org-habit-show-habits-only-for-today)
 (defvar org-habit-show-all-today)
+(defvar org-habit-scheduled-past-days)
 
 ;; Defined somewhere in this file, but used before definition.
 (defvar org-agenda-buffer-name "*Org Agenda*")
@@ -6201,7 +6202,8 @@ scheduled items with an hour specification like [h]h:mm."
   habitp
   (bound-and-true-p org-habit-show-all-today))
(when (or (and (> ddays 0) (< diff ddays))
- (> diff org-scheduled-past-days)
+ (> diff (or (and habitp org-habit-scheduled-past-days)
+ org-scheduled-past-days))
  (> schedule current)
  (and (/= current schedule)
   (/= current today)
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index af4520729..88df38ce0 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -89,6 +89,21 @@ It will be green even if it was done after the deadline."
   :group 'org-habit
   :type 'boolean)
 
+(defcustom org-habit-scheduled-past-days nil
+"Value to use instead of `org-scheduled-past-days', for habits only.
+
+If nil, `org-scheduled-past-days' is used.
+
+Setting this to say 1 is a way to make habits always show up
+as a reminder, even if you set `org-scheduled-past-days' to a
+small value because you regard scheduled items as a way of
+\"turning on\" TODO items on a particular date, rather than as a
+means of creating calendar-based reminders."
+  :group 'org-habit
+  :type '(choice integer (const nil))
+  :package-version '(Org . "9.3")
+  :safe (lambda (v) (or (integerp v) (null v
+
 (defface org-habit-clear-face
   'background light)) (:background "#8270f9"))
 (((background dark)) (:background "blue")))
-- 
2.17.1




Re: [O] org-habit: allow overriding org-scheduled-past-days and always including time of day

2019-02-03 Thread John Lee
On Sun, 18 Nov 2018, at 23:40, Nicolas Goaziou wrote:
> * 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)

Oops, I just remembered that 0 is not "falsy" in elisp.  So I'll make this 
change after all and submit that first patch again, again...



[O] [PATCH 3/3] org-habit: Use face 'org-agenda-done for habits scheduled for future

2019-02-03 Thread John Lee
* lisp/org-agenda.el (org-agenda-get-scheduled): Use the face.

This has the effect that if you just did the habit, it is "greyed out"
in the agenda.

TINYCHANGE
---
 lisp/org-agenda.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 39ae85f30..17fa3e519 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6165,6 +6165,7 @@ scheduled items with an hour specification like [h]h:mm."
   (diff (- current schedule))
   (warntime (get-text-property (point) 'org-appt-warntime))
   (pastschedp (< schedule today))
+  (futureschedp (> schedule today))
   (habitp (and (fboundp 'org-is-habit-p) (org-is-habit-p)))
   (suppress-delay
(let ((deadline (and org-agenda-skip-scheduled-delay-if-deadline
@@ -6285,6 +6286,8 @@ scheduled items with an hour specification like [h]h:mm."
 head level category tags time nil habitp))
   (face (cond ((and (not habitp) pastschedp)
'org-scheduled-previously)
+  ((and habitp futureschedp)
+   'org-agenda-done)
   (todayp 'org-scheduled-today)
   (t 'org-scheduled)))
   (habitp (and habitp (org-habit-parse-todo
-- 
2.17.1




[O] [PATCH 2/3] org-habit: Always show time of day designation for habits

2019-02-03 Thread John Lee
* org-agenda.el (org-agenda-get-scheduled): Always show the time of
  day designation for habits

TINYCHANGE
---
 lisp/org-agenda.el | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9145cafa8..39ae85f30 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6261,9 +6261,17 @@ 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, except for habits, which always show
+;; the time of day.  Habits are an exception
+;; because if there is a time of day, that is
+;; interpreted to mean they should usually happen
+;; then, even if doing the habit was missed.
+((and
+  (not habitp)
+  (/= current schedule)
+  (/= current repeat))
+ nil)
 ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
  (concat (substring s (match-beginning 1)) " "))
 (t 'time)))
-- 
2.17.1




[O] [PATCH 1/3] org-habit: Add org-habit-scheduled-past-days

2019-02-03 Thread John Lee
* lisp/org-habit.el (org-habit-scheduled-past-days): New variable

* lisp/org-agenda.el (org-agenda-get-scheduled): override
  `org-scheduled-past-days' for habits if
  `org-habit-scheduled-past-days` is not nil

TINYCHANGE
---
 lisp/org-agenda.el |  8 +++-
 lisp/org-habit.el  | 15 +++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 489ecec95..9145cafa8 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -90,6 +90,7 @@
 (defvar org-habit-show-habits)
 (defvar org-habit-show-habits-only-for-today)
 (defvar org-habit-show-all-today)
+(defvar org-habit-scheduled-past-days)
 
 ;; Defined somewhere in this file, but used before definition.
 (defvar org-agenda-buffer-name "*Org Agenda*")
@@ -6201,7 +6202,12 @@ scheduled items with an hour specification like [h]h:mm."
   habitp
   (bound-and-true-p org-habit-show-all-today))
(when (or (and (> ddays 0) (< diff ddays))
- (> diff org-scheduled-past-days)
+ (> diff
+(if habitp
+(if (null org-habit-scheduled-past-days)
+org-scheduled-past-days
+  org-habit-scheduled-past-days)
+  org-scheduled-past-days))
  (> schedule current)
  (and (/= current schedule)
   (/= current today)
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index af4520729..88df38ce0 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -89,6 +89,21 @@ It will be green even if it was done after the deadline."
   :group 'org-habit
   :type 'boolean)
 
+(defcustom org-habit-scheduled-past-days nil
+"Value to use instead of `org-scheduled-past-days', for habits only.
+
+If nil, `org-scheduled-past-days' is used.
+
+Setting this to say 1 is a way to make habits always show up
+as a reminder, even if you set `org-scheduled-past-days' to a
+small value because you regard scheduled items as a way of
+\"turning on\" TODO items on a particular date, rather than as a
+means of creating calendar-based reminders."
+  :group 'org-habit
+  :type '(choice integer (const nil))
+  :package-version '(Org . "9.3")
+  :safe (lambda (v) (or (integerp v) (null v
+
 (defface org-habit-clear-face
   'background light)) (:background "#8270f9"))
 (((background dark)) (:background "blue")))
-- 
2.17.1




Re: [O] Mark vacation days

2019-02-03 Thread John Lee
I don't know a good way to do this out of the box.  Here are two ways you could 
go about it, but they both involve a bit of programming.  They would all use 
org-agenda-day-face-function similar to the code you already posted.

1. Least programming: Add emacs diary entries (rather than recording the days 
using org datestamps -- see 
https://www.gnu.org/software/emacs/manual/html_node/emacs/Special-Diary-Entries.html)
 and adapt https://emacs.stackexchange.com/a/45778/5495 to check diary-lib.el 
instead of holidays.el .  Note this won't work by using the support for adding 
diary sexps directly to org files 
(https://orgmode.org/manual/Weekly_002fdaily-agenda.html#Calendar_002fDiary-integration)
 without something extra, because then the diary sexp information is only in 
org, not in the emacs diary itself, so you can't just look in 
diary-entries-list.  All pretty confusing I know.

Untested (!) based on adapting the stack exchange answer above to extend that 
(which pulls in holiday.el holidays + tests whether the day is a weekend -- the 
following is intended to hint how to extend that to pull in diary-lib.el dates 
too):

Note I'm guessing you'd have to set org-agenda-include-diary for this to work, 
but I have not tested this *at all*, so this really is all just a hint.  Also, 
watch out for the weird dependence of diary-lib.el on calendar-date-style.

(defface my/org-agenda-holiday '((t (:inherit default)))
  "Base face used in agenda for holidays, whether today's date or not."
  :group 'org-faces)
(defface my/org-agenda-holiday-not-today '((t (:inherit (my/org-agenda-holiday 
org-agenda-date
  "Face used in agenda for holidays other than for today's date."
  :group 'org-faces)
(defface my/org-agenda-holiday-today '((t (:inherit (my/org-agenda-holiday 
org-agenda-date-today
  "Face used in agenda for holidays for today's date."
  :group 'org-faces)

(defun my/in-diary-p (date)
  (car (alist-get date diary-entries-list nil nil #'equal)))

(defun my/day-face (day)
  (let* ((abs (calendar-absolute-from-gregorian day))
 (todayp (org-agenda-today-p abs))
 (day-of-week (calendar-day-of-week day))
 (holidayp (or
(= day-of-week 0) (= day-of-week 6)
(holiday-in-range abs abs)
(my/in-diary-p day
(cond ((and todayp holidayp) 'my/org-agenda-holiday-today)
  (holidayp 'my/org-agenda-holiday-not-today)
  (todayp 'org-agenda-date-today)
  (t 'org-agenda-date
(setq org-agenda-day-face-function #'my/day-face)


2. Maybe nicer: write something similar to org-agenda-to-appt that generates a 
list of holiday days rather than appointments, then run that code from places 
like 'after-save-hook.  Then consult that list in your 
org-agenda-day-face-function.

On Sun, 27 Jan 2019, at 20:41, JRSS wrote:
> What if you set the category in the function? So the function has 
> something like cond (( or (org-category vacation) (org-category f_event)
> (background: red))
> 
> I obviously don't know how to write it, but the idea is that the 
> categories are already set in the function. I won't have many, three 
> tops, and I won't change them often -- no need to be fully dynamic.
> 
> Sent from ProtonMail mobile
> 
>  Original Message 
> On Jan 27, 2019, 15:35, Ken Mankoff wrote:
> 
> > Hi,
> >
> > On 2019-01-27 at 12:20 -0800, JRSS  wrote...
> >> This is a bit over my head still. I'm trying to wrap my head around it.
> >>
> >> I see what it does (colors day-of-the-week 1 and day-of-the-week-3,
> >> which are Monday and Wednesday, red) but not sure how to tie it to a
> >> category (so say, category "vacation" would be red).
> >>
> >> Once I have the function do that, I can go in and change it so that
> >> different categories will be different colors.
> >
> > It's a bit over my head for this use case too. Sorry. When I saw it I 
> > thought the use case was a list of holidays, which is easier to implement. 
> > You could maintain this list in an easy-to-access format as a variable near 
> > where you implement this function. A dynamic list based on tagged Org items 
> > is certainly more complicated.
> >
> > -k.



Re: [O] org-habit: allow overriding org-scheduled-past-days and always including time of day

2019-02-02 Thread John Lee
On Sun, 18 Nov 2018, at 23:40, Nicolas Goaziou wrote:
> Hello,

Hi, sorry Nicolas I totally missed your review comments!

> John Lee  writes:

For context since it's months ago now:

> > 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 don't know.  There's always somebody :-)  Perhaps nobody has filed an issue 
before because some people find the current behaviour useful -- but perhaps 
it's only because nobody uses times for habits, maybe because of this very 
issue.

Trying hard to make up a reason for utility of the current behaviour: let's say 
your habits tend to be weekly and have an optimum time and weekday, but if you 
miss them it's just "as soon as possible".  But if anybody actually does see 
their habits that way, that would seem likely to vary by habit.  So I'd be 
surprised if the current behaviour was very useful.

Shall I make it the default, then?


> > 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.

Thank you.  Right now I have one other change I'd like to submit which is also 
tiny, do I need to start the assignment process?


> > +(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,

To me it looks like a full sentence?  Should it be something like this below 
(based on looking at other docstrings)?

"Value to use instead of `org-scheduled-past-days', for habits only.

If nil, `org-scheduled-past-days' is used."


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

I think "as a mean of" is not correct English (I'm a native speaker in the UK).


> > +  :group 'org-habit
> > +  :type 'integer)
> 
> You need to add :package-version and :safe keywords.

Presumably I should use the version from the highest current git tag "plus 
one", i.e. 9.3?

:package-version '(Org . "9.3")


Thanks for your comments



[O] [PATCH] org-habit: allow overriding org-scheduled-past-days and always including time of day

2018-11-05 Thread John Lee
I guess I'm supposed to add the [PATCH] tag to the subject line?  So this email 
is just to do that.

Sorry if I've missed some instructions about this...

On Mon, 5 Nov 2018, at 00:31, John Lee wrote:
> Hi
> 
> 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"!
> 
> 
> Does the idea behind each of these seem appropriate to people?  They 
> work for me of course, and behaviour is unchanged unless you set non-
> default values for the new variables -- but I know people have different 
> workflows.
> 
> 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'.
> 
> 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'.
> 
> I have not yet submitted the FSF copyright assignment form but am 
> prepared to do so.
> 
> 
> From 7bcf7b70b201af7a3d3cbbcf6a95511944370627 Mon Sep 17 00:00:00 2001
> From: John Lee 
> Date: Sun, 4 Nov 2018 23:11:17 +
> Subject: [PATCH 1/2] org-habit: Add org-habit-scheduled-past-days
> 
> * lisp/org-habit.el: Add new variable `org-habit-scheduled-past-days'
>   to allow overriding `org-scheduled-past-days' for habits
> 
> * lisp/org-agenda.el (org-agenda-get-scheduled): override
>   `org-scheduled-past-days' for habits if
>   `org-habit-scheduled-past-days` is not nil
> ---
>  lisp/org-agenda.el |  5 -
>  lisp/org-habit.el  | 11 +++
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 180a0612c..e2bd5cc2d 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -6196,7 +6196,10 @@ scheduled items with an hour specification like 
> [h]h:mm."
>  habitp
>  (bound-and-true-p org-habit-show-all-today))
>   (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))
> (> schedule current)
> (and (/= current schedule)
>  (/= current today)
> diff --git a/lisp/org-habit.el b/lisp/org-habit.el
> index 375714e35..b8415bdde 100644
> --- a/lisp/org-habit.el
> +++ b/lisp/org-habit.el
> @@ -89,6 +89,17 @@ It will be green even if it was done after the deadline."
>:group 'org-habit
>:type 'boolean)
>  
> +(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.
> +Setting this to say 1 is a way to make habits always show up
> +as a reminder, even if you set org-scheduled-past-days to a small
> +value because you regard SCHEDULED items as a way of 'turning on'
> +TODO items on a particular date, rather than as a means of
> +creating calendar-based reminders."
> +  :group 'org-habit
> +  :type 'integer)
> +
>  (defface org-habit-clear-face
>'background light)) (:background "#8270f9"))
>  (((background dark)) (:background "blue")))
> -- 
> 2.17.1
> 
> From a1d6e3a

[O] org-habit: allow overriding org-scheduled-past-days and always including time of day

2018-11-04 Thread John Lee
Hi

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"!


Does the idea behind each of these seem appropriate to people?  They work for 
me of course, and behaviour is unchanged unless you set non-default values for 
the new variables -- but I know people have different workflows.

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'.

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'.

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


>From 7bcf7b70b201af7a3d3cbbcf6a95511944370627 Mon Sep 17 00:00:00 2001
From: John Lee 
Date: Sun, 4 Nov 2018 23:11:17 +
Subject: [PATCH 1/2] org-habit: Add org-habit-scheduled-past-days

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

* lisp/org-agenda.el (org-agenda-get-scheduled): override
  `org-scheduled-past-days' for habits if
  `org-habit-scheduled-past-days` is not nil
---
 lisp/org-agenda.el |  5 -
 lisp/org-habit.el  | 11 +++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 180a0612c..e2bd5cc2d 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6196,7 +6196,10 @@ scheduled items with an hour specification like [h]h:mm."
   habitp
   (bound-and-true-p org-habit-show-all-today))
(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))
  (> schedule current)
  (and (/= current schedule)
   (/= current today)
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index 375714e35..b8415bdde 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -89,6 +89,17 @@ It will be green even if it was done after the deadline."
   :group 'org-habit
   :type 'boolean)
 
+(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.
+Setting this to say 1 is a way to make habits always show up
+as a reminder, even if you set org-scheduled-past-days to a small
+value because you regard SCHEDULED items as a way of 'turning on'
+TODO items on a particular date, rather than as a means of
+creating calendar-based reminders."
+  :group 'org-habit
+  :type 'integer)
+
 (defface org-habit-clear-face
   'background light)) (:background "#8270f9"))
 (((background dark)) (:background "blue")))
-- 
2.17.1

>From a1d6e3af978237b3f555682a111c2439f17b45b9 Mon Sep 17 00:00:00 2001
From: John Lee 
Date: Sun, 4 Nov 2018 23:17:15 +
Subject: [PATCH 2/2] org-habit: Add org-habit-always-show-time

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

* 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 @@