all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] org-agenda-span treats 7 differently [9.4.6 (9.4.6-g3ba46c @ ~/.emacs.d/straight/build/org/)]
@ 2023-01-12 18:09 Eppo Math
  2023-01-13  9:25 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Eppo Math @ 2023-01-12 18:09 UTC (permalink / raw)
  To: emacs-orgmode

Many thanks in advance for taking the time to read this!

Issue: In an org agenda block (fed to org-agenda-custom-commands), the
number 7 passed to org-agenda-span causes the resulting block to begin
on the first day of the week, ignoring org-agenda-start-day.

Expected Behaviour: org-agenda-start-day and org-agenda-span should be
options with independent behaviours.

Actual Behaviour: When org-agenda-span is set to 7, the given argument
org-agenda-start-day is ignored.

Steps to Reproduce:
1. Save the following to /any-path/test.el:
#+begin_src elisp
(defun my-generate-agenda-block (START SPAN)
"Generate an agenda block for testing"
`((org-agenda-start-day ,START)
(org-agenda-span ,SPAN)
(org-agenda-overriding-header
(concat "\norg-agenda-start-day: " ,START
"\norg-agenda-span: " (number-to-string ,SPAN)))))

(setq org-agenda-custom-commands
`(("t" "Test of Agenda Blocks" (
(agenda "" ,(my-generate-agenda-block "-2d" 7))
(agenda "" ,(my-generate-agenda-block "-2d" 5))
(agenda "" ,(my-generate-agenda-block "-5d" 7))
(agenda "" ,(my-generate-agenda-block "-5d" 5))
(agenda "" ,(my-generate-agenda-block "+1d" 7))
(agenda "" ,(my-generate-agenda-block "+1d" 5))))))

(defun my-org-agenda-test () (interactive) (org-agenda "a" "t"))
#+end_src
2. Run =emacs -Q -l /any-path/test.el= at a terminal.
3. Within Emacs, run =M-x my-org-agenda-test=.

Additional Notes:
1. The order of org-agenda-start-day and org-agenda-span is irrelevant.
2. The emacs manual does not say anything helpful for either variable.
3. I've only tested "+nd" and "-nd" syntax for org-agenda-start-day.
4. My ~init.el~ is irrelevent (bug present when run from =emacs -Q=).

Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.30, cairo version 1.16.0)
of 2022-01-24, modified by Debian
Package: Org mode version 9.4.6 (9.4.6-g3ba46c @ 
~/.emacs.d/straight/build/org/)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] org-agenda-span treats 7 differently [9.4.6 (9.4.6-g3ba46c @ ~/.emacs.d/straight/build/org/)]
  2023-01-12 18:09 [BUG] org-agenda-span treats 7 differently [9.4.6 (9.4.6-g3ba46c @ ~/.emacs.d/straight/build/org/)] Eppo Math
@ 2023-01-13  9:25 ` Ihor Radchenko
       [not found]   ` <01e57c89-e570-ff4d-5286-ff4c0a17f703@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2023-01-13  9:25 UTC (permalink / raw)
  To: Eppo Math; +Cc: emacs-orgmode

Eppo Math <eppolito.math@gmail.com> writes:

> Many thanks in advance for taking the time to read this!
>
> Issue: In an org agenda block (fed to org-agenda-custom-commands), the
> number 7 passed to org-agenda-span causes the resulting block to begin
> on the first day of the week, ignoring org-agenda-start-day.
>
> Expected Behaviour: org-agenda-start-day and org-agenda-span should be
> options with independent behaviours.
>
> Actual Behaviour: When org-agenda-span is set to 7, the given argument
> org-agenda-start-day is ignored.

This is because of `org-agenda-start-on-weekday' defaulting to 1.
You can bind it to nil in your custom agenda view.

I think we can update the docstrings for `org-agenda-start-day' and
`org-agenda-start-on-weekday' explaining that the latter takes
precedence when agenda span is a week or more.

Will it be enough for you?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] org-agenda-span treats 7 differently [9.4.6 (9.4.6-g3ba46c @ ~/.emacs.d/straight/build/org/)]
       [not found]     ` <87fscc88lj.fsf@localhost>
@ 2023-01-16 10:46       ` Ihor Radchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2023-01-16 10:46 UTC (permalink / raw)
  To: Eppo Math; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Eppo Math <eppolito.math@gmail.com> writes:
>
>>> I think we can update the docstrings for `org-agenda-start-day' and
>>> `org-agenda-start-on-weekday' explaining that the latter takes
>>> precedence when agenda span is a week or more.
>
> See the attached patch.

Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=12bcd322d

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-16 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-12 18:09 [BUG] org-agenda-span treats 7 differently [9.4.6 (9.4.6-g3ba46c @ ~/.emacs.d/straight/build/org/)] Eppo Math
2023-01-13  9:25 ` Ihor Radchenko
     [not found]   ` <01e57c89-e570-ff4d-5286-ff4c0a17f703@gmail.com>
     [not found]     ` <87fscc88lj.fsf@localhost>
2023-01-16 10:46       ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.