Re: One thing each 3 days but maximum 10

2022-11-01 Thread Ihor Radchenko
Jean Louis  writes:

> * Ihor Radchenko  [2022-10-31 09:27]:
>> Thanks for pointing this out!
>> Hours are, in fact, allowed.
>> Fixed the manual now.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5098404b19962042cd29ad86e11ccb43ac566953
>
> That is great.
>
> How certain is that function, does it work reliably? How was it
> tested?
>
> I still do get:
>
> user-error: Invalid shift specification +1h
>
> Org mode version 9.4.3 (9.4.3-elpa @
> /home/data1/protected/.emacs.d/elpa/org-20201216/)

Hour repeaters are only parsed interactively on main.
Repeaters in timestamps should work in earlier Org versions as well.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: One thing each 3 days but maximum 10

2022-11-01 Thread Jean Louis
* Quiliro Ordóñez  [2022-10-31 13:03]:
> El 2022-10-30 23:57, Jean Louis escribió:
> > * Renato Pontefice  [2022-10-30 19:11]:
> >> I have to take a pill each 3 days, but for max 10 times.
> >> So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me 
> >> that I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
> >> I nean to show how many pill I have already take?
> > 
> > Use PostgreSQL to give you schedule:
> > 
> > #+BEGIN_SRC sql :engine postgresql :results value raw 
> > SELECT '** TODO Take pill again
> >   SCHEDULED: <' || generate_series('2022-10-28', '2022-11-26', '3
> > day'::interval)::date || E'>\n'
> >   AS "* My treatement";
> > #+END_SRC

> Isn't it much easier to copy the first one and change the day, instead
> of going through the learning curve of database administration?  Of
> course that, if you have a bazooka, you can even write a love letter
> with it.  But would it be right tool?

Any useful tool external to any text file that may help you in work
and life, is the right tool. Use anything you find useful.

To correct you, this is not "database administration", it is using
PostgreSQL like programming language. If there would be ready Emacs
Lisp function, I would mention it, but I do not know any.

This belowe is pretty much intuitive:

SELECT generate_series('2022-10-28', '2022-11-26', '3 day'::interval);

SELECT generate_series('2022-10-28', '2022-11-26', '3 day'::interval);
generate_series 

 2022-10-28 00:00:00+03
 2022-10-31 00:00:00+03
 2022-11-03 00:00:00+03
 2022-11-06 00:00:00+03
 2022-11-09 00:00:00+03
 2022-11-12 00:00:00+03
 2022-11-15 00:00:00+03
 2022-11-18 00:00:00+03
 2022-11-21 00:00:00+03
 2022-11-24 00:00:00+03

And you can have it display it with date only:

SELECT generate_series('2022-10-28', '2022-11-26', '3 day'::interval)::date;

 generate_series 
-
 2022-10-28
 2022-10-31
 2022-11-03
 2022-11-06
 2022-11-09
 2022-11-12
 2022-11-15
 2022-11-18
 2022-11-21
 2022-11-24

And you may concatenate it how you wish:

SELECT 'This is my day: ' || generate_series('2022-10-28', '2022-11-26', '3 
day'::interval)::date;

 This is my day: 2022-10-28
 This is my day: 2022-10-31
 This is my day: 2022-11-03
 This is my day: 2022-11-06
 This is my day: 2022-11-09
 This is my day: 2022-11-12
 This is my day: 2022-11-15
 This is my day: 2022-11-18
 This is my day: 2022-11-21
 This is my day: 2022-11-24

And there are complex intervals, readable to human:

SELECT 'This is my day: ' || generate_series('2022-10-28', '2022-10-29', '1 
hour 2 minutes'::interval);

 This is my day: 2022-10-28 00:00:00+03
 This is my day: 2022-10-28 01:02:00+03
 This is my day: 2022-10-28 02:04:00+03
 This is my day: 2022-10-28 03:06:00+03
 This is my day: 2022-10-28 04:08:00+03
 This is my day: 2022-10-28 05:10:00+03
 This is my day: 2022-10-28 06:12:00+03
 This is my day: 2022-10-28 07:14:00+03
 This is my day: 2022-10-28 08:16:00+03
 This is my day: 2022-10-28 09:18:00+03
 This is my day: 2022-10-28 10:20:00+03
 This is my day: 2022-10-28 11:22:00+03
 This is my day: 2022-10-28 12:24:00+03
 This is my day: 2022-10-28 13:26:00+03
 This is my day: 2022-10-28 14:28:00+03
 This is my day: 2022-10-28 15:30:00+03
 This is my day: 2022-10-28 16:32:00+03
 This is my day: 2022-10-28 17:34:00+03
 This is my day: 2022-10-28 18:36:00+03
 This is my day: 2022-10-28 19:38:00+03
 This is my day: 2022-10-28 20:40:00+03
 This is my day: 2022-10-28 21:42:00+03
 This is my day: 2022-10-28 22:44:00+03
 This is my day: 2022-10-28 23:46:00+03

Now after learning about the flexibility and power of that function,
you may think of using intervals for anything you wish.

Within Org, you may embed it how you wish and want, including, you
may produce tables with that function. 

Org's function `org-clone-subtree-with-time-shift' I find really
handy, but I also find it hard coded, it is only for subtree. 

And I personally can rely on it as Org has too many bugs and is
constantly developed. We have just found that "hours" are missing,
which speaks of design planning quality level.

Why would one exclude seconds? Just because author of function does
not use seconds, that is why author excluded seconds, and minutes, and
hours in the original function. 

Do I want to use a function which possibly contains errors? There are
too many human errors when dealing with time, unspoken of programming
errors.

My choice is to use what I consider stable, and which is more
flexible. 

As Org may be dynamically modified by external tool, then I will use
any kind of tool.

My Org file are mostly on the file system, there are maybe 300 files,
and only 38 in the database. But then I use in the database too much
of Markdown, and way much more of the text type.

And any kind of the markup I want to use embeddable external
tools. This is because it is useful. 

Personally I do not want to remain hard coded to Org type only, as it
limits my work, my output, my PDF and 

Re: One thing each 3 days but maximum 10

2022-11-01 Thread Jean Louis
* Ihor Radchenko  [2022-10-31 09:27]:
> Thanks for pointing this out!
> Hours are, in fact, allowed.
> Fixed the manual now.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5098404b19962042cd29ad86e11ccb43ac566953

That is great.

How certain is that function, does it work reliably? How was it
tested?

I still do get:

user-error: Invalid shift specification +1h

Org mode version 9.4.3 (9.4.3-elpa @
/home/data1/protected/.emacs.d/elpa/org-20201216/)

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: One thing each 3 days but maximum 10

2022-10-31 Thread Quiliro Ordóñez
El 2022-10-30 23:57, Jean Louis escribió:
> * Renato Pontefice  [2022-10-30 19:11]:
>> I have to take a pill each 3 days, but for max 10 times.
>> So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me 
>> that I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
>> I nean to show how many pill I have already take?
> 
> Use PostgreSQL to give you schedule:
> 
> #+BEGIN_SRC sql :engine postgresql :results value raw 
> SELECT '** TODO Take pill again
>   SCHEDULED: <' || generate_series('2022-10-28', '2022-11-26', '3
> day'::interval)::date || E'>\n'
>   AS "* My treatement";
> #+END_SRC
> 
> #+RESULTS:
> * My treatement
> ** TODO Take pill again
>   SCHEDULED: <2022-10-28>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-10-31>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-11-03>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-11-06>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-11-09>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-11-12>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-11-15>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-11-18>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-11-21>
> 
> ** TODO Take pill again
>   SCHEDULED: <2022-11-24>


Isn't it much easier to copy the first one and change the day, instead
of going through the learning curve of database administration?  Of
course that, if you have a bazooka, you can even write a love letter
with it.  But would it be right tool?



Re: One thing each 3 days but maximum 10

2022-10-31 Thread Ihor Radchenko
Jean Louis  writes:

> If we ask Org documentation what is "repeater", then I get this
> information:
>
> Timestamp with repeater interval
>  A timestamp may contain a _repeater interval_, indicating that it
>  applies not only on the given date, but again and again after a
>  certain interval of N days (d), weeks (w), months (m), or years
>  (y).  The following shows up in the agenda every Wednesday:
>
>   * Pick up Sam at school
> <2007-05-16 Wed 12:30 +1w>
>
> And that excludes hours, unspoken of other intervals. 

Thanks for pointing this out!
Hours are, in fact, allowed.
Fixed the manual now.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5098404b19962042cd29ad86e11ccb43ac566953

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: One thing each 3 days but maximum 10

2022-10-31 Thread Jean Louis
* Ihor Radchenko  [2022-10-31 08:15]:
> Jean Louis  writes:
> 
> > * Renato Pontefice  [2022-10-30 19:11]:
> >> I have to take a pill each 3 days, but for max 10 times.
> >> So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me 
> >> that I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
> >> I nean to show how many pill I have already take?
> >
> > Use PostgreSQL to give you schedule:
> >
> > #+BEGIN_SRC sql :engine postgresql :results value raw 
> > SELECT '** TODO Take pill again
> >   SCHEDULED: <' || generate_series('2022-10-28', '2022-11-26', '3 
> > day'::interval)::date || E'>\n' 
> >   AS "* My treatement";
> > #+END_SRC
> >
> > #+RESULTS:
> > * My treatement
> > ** TODO Take pill again
> >   SCHEDULED: <2022-10-28>
> >
> > ** TODO Take pill again
> >   SCHEDULED: <2022-10-31>
> 
> This is not a good idea for pills.

I am afraid you forgot the fact that prescriptions have variable time
periods. It is rather unusual to take pills every 3 days, and rather
common for many diseases to take pills every 8 or 12 hours.

> Without SQL, one could also use org-clone-subtree-with-time-shift, but
> AFAIK, the whole idea behind schedule of taking pills is to retain
> certain concentration of medicine in the blood flow. Hence .+3d repeater
> (3d from the last time taking the pill) is more suitable.

If we ask Org documentation what is "repeater", then I get this
information:

Timestamp with repeater interval
 A timestamp may contain a _repeater interval_, indicating that it
 applies not only on the given date, but again and again after a
 certain interval of N days (d), weeks (w), months (m), or years
 (y).  The following shows up in the agenda every Wednesday:

  * Pick up Sam at school
<2007-05-16 Wed 12:30 +1w>

And that excludes hours, unspoken of other intervals. 

That renders the function `org-clone-subtree-with-time-shift' not
suitable for prescription notification.

In fact it is great health risk to recommend to people to use Org to
track one's medical treatment due to too many "bugs" involved.

And here is hours "repeater" by using external tool PostgreSQL:

#+BEGIN_SRC sql :engine postgresql :results value raw 
SELECT '** TODO Take pill again
  SCHEDULED: <' || generate_series('2022-10-28', '2022-11-04', '8 
hours'::interval)::timestamptz || E'>\n' 
  AS "* My treatement";
#+END_SRC

#+RESULTS:
* My treatement
** TODO Take pill again
  SCHEDULED: <2022-10-28 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-28 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-28 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-29 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-29 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-29 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-30 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-30 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-30 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-31 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-31 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-31 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-01 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-01 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-01 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-02 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-02 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-02 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-03 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-03 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-03 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-04 00:00:00+03>



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: One thing each 3 days but maximum 10

2022-10-30 Thread Ihor Radchenko
Jean Louis  writes:

> * Renato Pontefice  [2022-10-30 19:11]:
>> I have to take a pill each 3 days, but for max 10 times.
>> So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me 
>> that I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
>> I nean to show how many pill I have already take?
>
> Use PostgreSQL to give you schedule:
>
> #+BEGIN_SRC sql :engine postgresql :results value raw 
> SELECT '** TODO Take pill again
>   SCHEDULED: <' || generate_series('2022-10-28', '2022-11-26', '3 
> day'::interval)::date || E'>\n' 
>   AS "* My treatement";
> #+END_SRC
>
> #+RESULTS:
> * My treatement
> ** TODO Take pill again
>   SCHEDULED: <2022-10-28>
>
> ** TODO Take pill again
>   SCHEDULED: <2022-10-31>

This is not a good idea for pills.
Without SQL, one could also use org-clone-subtree-with-time-shift, but
AFAIK, the whole idea behind schedule of taking pills is to retain
certain concentration of medicine in the blood flow. Hence .+3d repeater
(3d from the last time taking the pill) is more suitable.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: One thing each 3 days but maximum 10

2022-10-30 Thread Jean Louis
* Renato Pontefice  [2022-10-30 19:11]:
> I have to take a pill each 3 days, but for max 10 times.
> So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me 
> that I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
> I nean to show how many pill I have already take?

Use PostgreSQL to give you schedule:

#+BEGIN_SRC sql :engine postgresql :results value raw 
SELECT '** TODO Take pill again
  SCHEDULED: <' || generate_series('2022-10-28', '2022-11-26', '3 
day'::interval)::date || E'>\n' 
  AS "* My treatement";
#+END_SRC

#+RESULTS:
* My treatement
** TODO Take pill again
  SCHEDULED: <2022-10-28>

** TODO Take pill again
  SCHEDULED: <2022-10-31>

** TODO Take pill again
  SCHEDULED: <2022-11-03>

** TODO Take pill again
  SCHEDULED: <2022-11-06>

** TODO Take pill again
  SCHEDULED: <2022-11-09>

** TODO Take pill again
  SCHEDULED: <2022-11-12>

** TODO Take pill again
  SCHEDULED: <2022-11-15>

** TODO Take pill again
  SCHEDULED: <2022-11-18>

** TODO Take pill again
  SCHEDULED: <2022-11-21>

** TODO Take pill again
  SCHEDULED: <2022-11-24>

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: One thing each 3 days but maximum 10

2022-10-30 Thread Ihor Radchenko
Renato Pontefice  writes:

> I have to take a pill each 3 days, but for max 10 times.
> So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me 
> that I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
> I nean to show how many pill I have already take?

Try

* TODO take pills [3/10]
SCHEDULED: <2022-10-31 Mon .+3d>
- [X] take 1
- [X] take 2
- [X] take 3
- [ ] take 4
- [ ] take 5
- [ ] take 6
- [ ] take 7
- [ ] take 8
- [ ] take 9
- [ ] take 10

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



One thing each 3 days but maximum 10

2022-10-30 Thread Renato Pontefice
I have to take a pill each 3 days, but for max 10 times.
So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me that 
I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
I nean to show how many pill I have already take?

Thank you

Renato