emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: Marcin Borkowski <mbork@mbork.pl>, emacs-orgmode@gnu.org
Subject: Re: What is a week?
Date: Mon, 24 Apr 2023 22:13:01 +0700	[thread overview]
Message-ID: <b4b3542a-0339-7ef6-c9b3-d3f88923ddca@gmail.com> (raw)
In-Reply-To: <874jp6beqj.fsf@mbork.pl>

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.


  parent reply	other threads:[~2023-04-24 15:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10  3:35 What is a week? Marcin Borkowski
2023-04-10  4:03 ` Marcin Borkowski
2023-04-10  6:04   ` Jude DaShiell
2023-04-10  7:46   ` Ihor Radchenko
2023-04-10 11:51     ` Max Nikulin
2023-04-10 12:07       ` Tim Landscheidt
2023-04-11 10:08         ` Ihor Radchenko
2023-04-24 15:47           ` Max Nikulin
2023-04-11 10:09       ` Ihor Radchenko
2023-04-11 11:34         ` Max Nikulin
2023-04-11 14:21           ` Marcin Borkowski
2023-04-23 17:57 ` Ihor Radchenko
2023-04-23 19:06   ` Marcin Borkowski
2023-04-23 19:18     ` Ihor Radchenko
2023-04-24  4:13       ` Marcin Borkowski
2023-04-24  6:26         ` Ihor Radchenko
2023-04-24 19:44           ` Marcin Borkowski
2023-04-24 20:05             ` Ihor Radchenko
2023-08-06 18:29               ` Bastien Guerry
2023-04-25 14:43             ` [PATCH] org-clock.el: Fix week start != 1 Max Nikulin
2023-05-07  8:06               ` Ihor Radchenko
2023-08-06 18:27             ` What is a week? Bastien
2023-04-24 15:13     ` Max Nikulin [this message]
2023-04-24 19:26       ` Marcin Borkowski

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=b4b3542a-0339-7ef6-c9b3-d3f88923ddca@gmail.com \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mbork@mbork.pl \
    /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).