Re: What is a week?

2023-08-06 Thread Bastien Guerry
Ihor Radchenko  writes:

> Thanks for the clarification.
> Bastien, I think we should update the copyright status in WORG. Maybe
> also inform FSF?

I've updated the status in Worg.

-- 
 Bastien



Re: What is a week?

2023-08-06 Thread Bastien
Hi Marcin,

I've found your entry in the FSF records for signed contributors but
if you have a new employer, he would have to sign the FSF assignment.

The form is here: https://orgmode.org/request-assign-future.txt

Of course, that's if you *want* to contribute with code and patches.
I do perfectly understand you might not want that, all other forms of
contributions are really appreciated too.

Best,

-- 
 Bastien



Re: What is a week?

2023-04-24 Thread Ihor Radchenko
Marcin Borkowski  writes:

> Complicated.  I did my copyright assignment (for Emacs and AUCTeX, but
> ...

Thanks for the clarification.
Bastien, I think we should update the copyright status in WORG. Maybe
also inform FSF?

> To be clear - I completely understand the "patches welcome" attitude to
> people complaining that something doesn't work as they expect -
> especially if those people are knowledgeable enough to fix the issue
> themselves.  I would very probably have done that several weeks ago if
> not for the copyright papers requirement.  If you think this is a good
> idea, I may spend some time preparing a detailed bug report, but please
> don't count on me submitting patches.

Detailed bug report will certainly help. I am a bit lost in what should
be expected here and what is being wrong on Org side.

Also, do note that "patches welcome" is not necessarily aiming at you
specifically. Anyone interested in submitting a patch is welcome.

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



Re: What is a week?

2023-04-24 Thread Marcin Borkowski


On 2023-04-24, at 08:26, Ihor Radchenko  wrote:

> Marcin Borkowski  writes:
>
>>> Patches welcome!
>>
>> Would gladly do.  Has the copyright papers requirement been lifted?
>
> Of course not, but don't you already have copyright assignment done?
> Our records list you as someone with copyright:
> https://orgmode.org/worg/contributors.html

Complicated.  I did my copyright assignment (for Emacs and AUCTeX, but
I guess this doesn't matter, since Org mode is part of Emacs anyway)
back when I worked in academia as a mathematician.  Now I am
a professional programmer, so I stopped contributing to Emacs -
I suspect I would need to sign a different form.  Also, my employer
probably should do the same.  And I assume that FSF might want to look
at my contract, which is in Polish, so someone would have to pay for the
translation, too.  Quite a lot of hurdles for relatively little gain.
And don't even mention what I think about that requirement in
particular, and in general about copyright law, American law and
American copyright law...

I certainly don't want to sound like a jerk, but I think I do not owe
anything to Emacs.  While Emacs is an important part of my life - and it
does make my life significantly better - I do my best to give back to
the Emacs community.  I wrote 300+ Emacs-related posts on my blog, more
are in the pipeline, I wrote an Elisp textbook (not free, but that is
intentional - I do not consider GPL nor the "free as in freedom"
approach to be necessarily a good idea for a textbook), I encourage
people to use Emacs (sometimes successfully).

To be clear - I completely understand the "patches welcome" attitude to
people complaining that something doesn't work as they expect -
especially if those people are knowledgeable enough to fix the issue
themselves.  I would very probably have done that several weeks ago if
not for the copyright papers requirement.  If you think this is a good
idea, I may spend some time preparing a detailed bug report, but please
don't count on me submitting patches.

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: What is a week?

2023-04-24 Thread Marcin Borkowski


On 2023-04-24, at 17:13, Max Nikulin  wrote:

> On 24/04/2023 02:06, Marcin Borkowski wrote:
>> Fair enough.  Still, I consider this a bug in the docs (they don't
>> say
>> clearly to set :wstart 7)...
>
> I do not think :wstart 7 gives expected result when run on any day
> other than Sunday. Current expression shifts interval start into
> future, see the last column

Ok, so now I am pretty confused...  I thought my experiments showed that
:wstart 7 works every time, now I'm not so sure anymore (especially that
it's very late here...).  I'll look into this tomorrow.

Thanks,

-- 
Marcin Borkowski
http://mbork.pl



Re: What is a week?

2023-04-24 Thread Max Nikulin

On 11/04/2023 17:08, Ihor Radchenko wrote:

Tim Landscheidt writes:


But there is calendar-week-start-day which I would expect
affected Emacs users to have customized.


It is not at all obvious that Org should be affected by calendar
customization. And we use different default - Monday, while
calendar-week-start-days defaults to Sunday.


In general, I agree that Org should respect `calendar-week-start-day'. 
However since different defaults are currently used (US vs. Europe 
conventions), I would wait till support support of calendar properties 
from Unicode Common Locale Data Repository. Users who have not 
customized value should not notice change.





Re: What is a week?

2023-04-24 Thread Max Nikulin

On 24/04/2023 02:06, Marcin Borkowski wrote:


Fair enough.  Still, I consider this a bug in the docs (they don't say
clearly to set :wstart 7)...


I do not think :wstart 7 gives expected result when run on any day other 
than Sunday. Current expression shifts interval start into future, see 
the last column


#+begin_src elisp
(let ((dow-seq (number-sequence 0 6))
  (wstart-seq (number-sequence 0 7))
  (shift 0)
  (diff (lambda (dow ws) ; taken from org-clock.el:
  (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws))
  (cons (cons "dow\\wstart" wstart-seq)
(mapcar
 (lambda (dow)
   (cons dow (mapcar (lambda (ws)
   (funcall diff dow ws))
 wstart-seq)))
 dow-seq)))
#+end_src

#+RESULTS:
| dow\wstart | 0 | 1 |  2 |  3 |  4 |  5 |  6 |  7 |
|  0 | 7 | 6 |  5 |  4 |  3 |  2 |  1 |  0 |
|  1 | 1 | 0 | -1 | -2 | -3 | -4 | -5 | -6 |
|  2 | 2 | 1 |  0 | -1 | -2 | -3 | -4 | -5 |
|  3 | 3 | 2 |  1 |  0 | -1 | -2 | -3 | -4 |
|  4 | 4 | 3 |  2 |  1 |  0 | -1 | -2 | -3 |
|  5 | 5 | 4 |  3 |  2 |  1 |  0 | -1 | -2 |
|  6 | 6 | 5 |  4 |  3 |  2 |  1 |  0 | -1 |

My expectation is values like in column "1" with appropriate cyclic shift.



Re: What is a week?

2023-04-24 Thread Ihor Radchenko
Marcin Borkowski  writes:

>> Patches welcome!
>
> Would gladly do.  Has the copyright papers requirement been lifted?

Of course not, but don't you already have copyright assignment done?
Our records list you as someone with copyright:
https://orgmode.org/worg/contributors.html

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



Re: What is a week?

2023-04-23 Thread Marcin Borkowski


On 2023-04-23, at 21:18, Ihor Radchenko  wrote:

> Marcin Borkowski  writes:
>
>> Fair enough.  Still, I consider this a bug in the docs (they don't say
>> clearly to set :wstart 7)...
>
> Patches welcome!

Would gladly do.  Has the copyright papers requirement been lifted?

-- 
Marcin Borkowski
http://mbork.pl



Re: What is a week?

2023-04-23 Thread Ihor Radchenko
Marcin Borkowski  writes:

> Fair enough.  Still, I consider this a bug in the docs (they don't say
> clearly to set :wstart 7)...

Patches welcome!

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



Re: What is a week?

2023-04-23 Thread Marcin Borkowski


On 2023-04-23, at 19:57, Ihor Radchenko  wrote:

> Marcin Borkowski  writes:
>
>> Now it's Monday.  I create a clock table with :wstart 1 and thisweek -
>> and my clock table starts today.
>>
>> What is the logic behind it?
>
> I saw you are considering this as a bug to be fixed.
> (https://mbork.pl/2023-04-22_Org_mode_clock_table_for_the_last_week)
>
> But please take a look at Max's email. I do not see changing the current
> :wstart 0 behaviour as a no-brainer.

Fair enough.  Still, I consider this a bug in the docs (they don't say
clearly to set :wstart 7)...

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: What is a week?

2023-04-23 Thread Ihor Radchenko
Marcin Borkowski  writes:

> Now it's Monday.  I create a clock table with :wstart 1 and thisweek -
> and my clock table starts today.
>
> What is the logic behind it?

I saw you are considering this as a bug to be fixed.
(https://mbork.pl/2023-04-22_Org_mode_clock_table_for_the_last_week)

But please take a look at Max's email. I do not see changing the current
:wstart 0 behaviour as a no-brainer.

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



Re: What is a week?

2023-04-11 Thread Marcin Borkowski


On 2023-04-11, at 13:34, Max Nikulin  wrote:

> On 11/04/2023 17:09, Ihor Radchenko wrote:
>> Max Nikulin writes:
>>> So at least some people expect 7, not 0. I would say, both variants
>>> should be acceptable.
>> Would you be interested to make a patch?
>
> Not really. I expect something like
>
>>(let* ((ws (mod (or wstart 1) 7))
>>(diff (+ (* -7 shift) (- dow ws) (if (> dow ws) 0 7
>
> I have realized that current behavior may be considered as
> a feature. Agenda obtained on Sunday allows to review previous working
> week. So :weekstart 0 and :weekstart 7 might behave
> differently. However to make it full-fledged feature, it is necessary

Actually, my question resulted from me noticing that "last week" behaves
weirdly and the decision to write a blog post about how to display
a clock table for the last week.  In that case, you can always say
`lastweek-1', so I'm not sure if the `0' setting is all that useful.

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: What is a week?

2023-04-11 Thread Max Nikulin

On 11/04/2023 17:09, Ihor Radchenko wrote:

Max Nikulin writes:

So at least some people expect 7, not 0. I would say, both variants
should be acceptable.


Would you be interested to make a patch?


Not really. I expect something like


   (let* ((ws (mod (or wstart 1) 7))
  (diff (+ (* -7 shift) (- dow ws) (if (> dow ws) 0 7


I have realized that current behavior may be considered as a feature. 
Agenda obtained on Sunday allows to review previous working week. So 
:weekstart 0 and :weekstart 7 might behave differently. However to make 
it full-fledged feature, it is necessary to introduce first_workday in 
addition to first_weekday. See properties reported by


 locale -k LC_TIME




Re: What is a week?

2023-04-11 Thread Ihor Radchenko
Max Nikulin  writes:

>>> #+BEGIN: clocktable :maxlevel 2 :scope agenda-with-archives
>>>  :weekstart 7 :block thisweek :step day :fileskip0 :narrow 20!
>>^^
>> 
>> should be :wstart -- let us know if it works!
>
> So at least some people expect 7, not 0. I would say, both variants 
> should be acceptable.

Would you be interested to make a patch?

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



Re: What is a week?

2023-04-11 Thread Ihor Radchenko
Tim Landscheidt  writes:

> But there is calendar-week-start-day which I would expect
> affected Emacs users to have customized.

It is not at all obvious that Org should be affected by calendar
customization. And we use different default - Monday, while
calendar-week-start-days defaults to Sunday.

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



Re: What is a week?

2023-04-10 Thread Tim Landscheidt
Max Nikulin  wrote:

> […]

> So at least some people expect 7, not 0. I would say, both
> variants should be acceptable.

> P.S. It seems, there is no way to get in Emacs first_weekday from locale(5)

But there is calendar-week-start-day which I would expect
affected Emacs users to have customized.

Tim




Re: What is a week?

2023-04-10 Thread Max Nikulin

On 10/04/2023 14:46, Ihor Radchenko wrote:

0bca49801eac749b6adf39b176b9455566faac85
Author: Bastien Guerry
org-clock.el: Implement a new parameter :wstart to define the week start day

-  (setq diff (+ (* -7 shift) (if (= dow 0) 6 (1- dow)))
+  (setq diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))

I am not sure if there is any particular reason.


https://list.orgmode.org/87y4z481yc@bzg.ath.cx/
Bastien. Re: Clocktable for this week starting at Sunday. Thu, 17 Apr 
2014 16:28:43 +0200

Torben Hoffmann writes:


#+BEGIN: clocktable :maxlevel 2 :scope agenda-with-archives
 :weekstart 7 :block thisweek :step day :fileskip0 :narrow 20!

   ^^

should be :wstart -- let us know if it works!


So at least some people expect 7, not 0. I would say, both variants 
should be acceptable.


P.S. It seems, there is no way to get in Emacs first_weekday from locale(5)




Re: What is a week?

2023-04-10 Thread Ihor Radchenko
Marcin Borkowski  writes:

>> Assume it's Sunday.  I create a clock table with :wstart 0 and
>> thisweek - and apparently my clock table starts 7 days ago.
>>
>> Now it's Monday.  I create a clock table with :wstart 1 and thisweek -
>> and my clock table starts today.
>>
>> What is the logic behind it?
>
> To clarify: I understand that the reason is the `if' from this line from
> `org-clock.el':
>
> (setq diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))
>
> (introduced ~10 years ago!).  But why is it coded this way?

The commit goes like

0bca49801eac749b6adf39b176b9455566faac85
Author: Bastien Guerry 
org-clock.el: Implement a new parameter :wstart to define the week start day

-  (setq diff (+ (* -7 shift) (if (= dow 0) 6 (1- dow)))
+  (setq diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))

I am not sure if there is any particular reason.

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



Re: What is a week?

2023-04-10 Thread Jude DaShiell
One of the iso standards has weeks starting on Monday.


-- Jude  "There are four boxes to be used in
defense of liberty: soap, ballot, jury, and ammo. Please use in that
order." Ed Howdershelt 1940.

On Mon, 10 Apr 2023, Marcin Borkowski wrote:

>
> On 2023-04-10, at 05:35, Marcin Borkowski  wrote:
>
> > Hi fellow Orgers,
> >
> > I'm trying to wrap my head around the notion of the week, for the
> > purpose of using weekly clock tables.
> >
> > Assume it's Sunday.  I create a clock table with :wstart 0 and
> > thisweek - and apparently my clock table starts 7 days ago.
> >
> > Now it's Monday.  I create a clock table with :wstart 1 and thisweek -
> > and my clock table starts today.
> >
> > What is the logic behind it?
>
> To clarify: I understand that the reason is the `if' from this line from
> `org-clock.el':
>
> (setq diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))
>
> (introduced ~10 years ago!).  But why is it coded this way?
>
> Best,
>
>



Re: What is a week?

2023-04-09 Thread Marcin Borkowski


On 2023-04-10, at 05:35, Marcin Borkowski  wrote:

> Hi fellow Orgers,
>
> I'm trying to wrap my head around the notion of the week, for the
> purpose of using weekly clock tables.
>
> Assume it's Sunday.  I create a clock table with :wstart 0 and
> thisweek - and apparently my clock table starts 7 days ago.
>
> Now it's Monday.  I create a clock table with :wstart 1 and thisweek -
> and my clock table starts today.
>
> What is the logic behind it?

To clarify: I understand that the reason is the `if' from this line from
`org-clock.el':

(setq diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))

(introduced ~10 years ago!).  But why is it coded this way?

Best,

-- 
Marcin Borkowski
http://mbork.pl



What is a week?

2023-04-09 Thread Marcin Borkowski
Hi fellow Orgers,

I'm trying to wrap my head around the notion of the week, for the
purpose of using weekly clock tables.

Assume it's Sunday.  I create a clock table with :wstart 0 and
thisweek - and apparently my clock table starts 7 days ago.

Now it's Monday.  I create a clock table with :wstart 1 and thisweek -
and my clock table starts today.

What is the logic behind it?

Help!

-- 
Marcin Borkowski
http://mbork.pl