From: Morgan Smith <Morgan.J.Smith@outlook.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Fix org-agenda-skip-scheduled-if-deadline-is-shown bug
Date: Tue, 02 Jan 2024 15:25:58 -0500 [thread overview]
Message-ID: <CH3PR84MB3424A06E5660054387793FCCC561A@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <87wmsu788v.fsf@localhost> (Ihor Radchenko's message of "Sun, 31 Dec 2023 14:32:32 +0000")
[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]
Ihor Radchenko <yantar92@posteo.net> writes:
> Morgan Smith <Morgan.J.Smith@outlook.com> writes:
>
>> lisp/org-agenda.el (org-agenda-get-scheduled): Consolidate deadline
>> fetching code. Don't check if deadline is shown when
>> 'org-agenda-skip-scheduled-if-deadline-is-shown' has a value of
>> 'repeated-after-deadline'.
>>
>> Currently when 'org-agenda-skip-scheduled-if-deadline-is-shown' has a
>> value of 'repeated-after-deadline' then there is no effect. This is
>> because when 'org-agenda-get-scheduled' is run on later dates, the
>> previous deadlines are not put in 'deadline-pos'.
>
> May you please provide a detailed reproducer demonstrating the bug you
> are trying to fix? Such reproducer could be a basis of a new test.
See a detailed reproducer attached to this mail. It has a task defined
as this:
* TODO task
SCHEDULED: <2017-03-06 Mon +2d> DEADLINE: <2017-03-10>
Running said reproducer currently fails as follows (the numbers are the
days of the month).
(string-equal
"06\nScheduled: task\n08\nScheduled: task\n10\nScheduled: task\nDeadline: task\n"
"06\nScheduled: task\n08\nScheduled: task\n10\nScheduled: task\nDeadline: task\n12\nScheduled: task\n")
As you can see, we expect to not see anything scheduled after the
deadline if 'org-agenda-skip-scheduled-if-deadline-is-shown' is set to
'repeated-after-deadline', however, we actually see that things continue
to be scheduled. Hence the bug is that that option currently does
nothing.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Testing-Add-tests-for-org-agenda-skip-scheduled-if-d.patch --]
[-- Type: text/x-patch, Size: 2949 bytes --]
From d7e72b9f0189b98d7ae59f0a56d54ffe70583956 Mon Sep 17 00:00:00 2001
From: Morgan Smith <Morgan.J.Smith@outlook.com>
Date: Tue, 2 Jan 2024 14:25:07 -0500
Subject: [PATCH] Testing: Add tests for
'org-agenda-skip-scheduled-if-deadline-is-shown'
* testing/lisp/test-org-agenda.el
(test-org-agenda/org-agenda-skip-scheduled-if-deadline-is-shown): New test.
---
testing/lisp/test-org-agenda.el | 45 +++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el
index 409d44192..6618fabc5 100644
--- a/testing/lisp/test-org-agenda.el
+++ b/testing/lisp/test-org-agenda.el
@@ -651,6 +651,51 @@ functions."
(should (= arg-f-call-cnt 1))
(should (equal f-called-args '(1 2 3))))))
+(ert-deftest test-org-agenda/org-agenda-skip-scheduled-if-deadline-is-shown ()
+ "Test values for `org-agenda-skip-scheduled-if-deadline-is-shown'."
+ (cl-assert (not org-agenda-sticky) nil "precondition violation")
+ (cl-assert (not (org-test-agenda--agenda-buffers))
+ nil "precondition violation")
+ (dolist (test-time '("2017-03-06" "2017-03-10"))
+ (let ((org-agenda-custom-commands
+ '(("f" "no fluff" agenda ""
+ ((org-agenda-overriding-header "")
+ (org-agenda-todo-keyword-format "")
+ (org-agenda-prefix-format "%s")
+ (org-agenda-format-date "%d")
+ (org-agenda-show-all-dates nil)))))
+ (org-deadline-warning-days 0)
+ (todayp (string= test-time "2017-03-10")))
+ (dolist (org-agenda-skip-scheduled-if-deadline-is-shown (list nil t 'not-today 'repeated-after-deadline))
+ (org-test-at-time test-time
+ (org-test-agenda-with-agenda
+ "
+* TODO task
+SCHEDULED: <2017-03-06 Mon +2d> DEADLINE: <2017-03-10>
+"
+ (should
+ (string-equal
+ (concat "06\n"
+ "Scheduled: task\n"
+ (if todayp ; We don't show repeats scheduled in the past
+ ""
+ "08\nScheduled: task\n")
+ "10\n"
+ (if (and org-agenda-skip-scheduled-if-deadline-is-shown
+ (not (and (not todayp) (eq org-agenda-skip-scheduled-if-deadline-is-shown 'not-today)))
+ (not (eq org-agenda-skip-scheduled-if-deadline-is-shown 'repeated-after-deadline)))
+ ""
+ (if todayp
+ "Sched. 4x: task\n"
+ "Scheduled: task\n"))
+ "Deadline: task\n"
+ (unless (eq org-agenda-skip-scheduled-if-deadline-is-shown 'repeated-after-deadline)
+ "12\nScheduled: task\n"))
+ (progn
+ (org-agenda nil "f")
+ (substring-no-properties (buffer-string)))))
+ (org-test-agenda--kill-all-agendas)))))))
+
\f
(provide 'test-org-agenda)
--
2.41.0
next prev parent reply other threads:[~2024-01-02 20:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-30 20:45 [PATCH] Fix org-agenda-skip-scheduled-if-deadline-is-shown bug Morgan Smith
2023-12-31 14:32 ` Ihor Radchenko
2024-01-02 20:25 ` Morgan Smith [this message]
2024-01-03 15:29 ` Ihor Radchenko
2024-01-03 17:06 ` Morgan Smith
2024-01-04 14:04 ` Ihor Radchenko
2024-01-16 16:45 ` Morgan Smith
2024-01-16 18:52 ` Ihor Radchenko
2024-01-16 20:37 ` Morgan Smith
2024-01-17 13:10 ` Ihor Radchenko
2024-02-07 12:27 ` Ihor Radchenko
2024-02-07 16:15 ` Bastien Guerry
2024-02-07 16:25 ` Ihor Radchenko
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=CH3PR84MB3424A06E5660054387793FCCC561A@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM \
--to=morgan.j.smith@outlook.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/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).