From: No Wayman <iarchivedmywholelife@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-add-planning-info: respect caller's given time [9.3.7 (release_9.3.7-716-g3d4876 @ /home/n/.emacs.d/straight/build/org/)]
Date: Tue, 18 Aug 2020 18:16:05 -0400 [thread overview]
Message-ID: <87zh6rfvmi.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
The current behavior of `org-add-planning-info' does not include
the time of day when
it is passed the TIME argument. This is because
`org-time-was-given' is initially let-bound to nil
during the scope of the function.
The attached patch removes that binding and allows the caller to
pass the time of day in the above case.
An example use case I use with org-capture templates:
(defun +org-schedule-relative-to-deadline ()
"Prompt for optional deadline, then an optional schedule time.
The scheduled default time is the deadline."
(interactive)
(condition-case nil
(org-deadline nil)
(quit nil))
(let ((org-overriding-default-time (or (org-get-deadline-time
(point))
org-overriding-default-time)))
;; works with patch, but without it the time of day is not
included in timestamp.
(org-schedule nil (org-read-date 'with-time 'to-time nil
"SCHEDULE: " org-overriding-default-time))))
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-add-planning-programmatic-time-of-day --]
[-- Type: text/x-patch, Size: 1291 bytes --]
From 2b0840a3963a16b4b92bfdad794a1327aa6f8bd4 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Tue, 18 Aug 2020 17:09:50 -0400
Subject: [PATCH] org: (org-add-planning-info): Respect caller's
`org-time-was-given' value
* lisp/org.el (org-add-planning-info): Respect caller's `org-time-was-given' value
Allows programmatically passing a time of day to `org-schedule'.
e.g. if one wanted to schedule a task relative to its DEADLINE time of day:
(org-schedule nil (org-read-date t t nil "SCHEDULE: "
(org-get-deadline-time (point))))
---
lisp/org.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index fb95590fc..aabdaebb9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10605,7 +10605,7 @@ among `closed', `deadline', `scheduled' and nil. TIME indicates
the time to use. If none is given, the user is prompted for
a date. REMOVE indicates what kind of entries to remove. An old
WHAT entry will also be removed."
- (let (org-time-was-given org-end-time-was-given default-time default-input)
+ (let (org-end-time-was-given default-time default-input)
(when (and (memq what '(scheduled deadline))
(or (not time)
(and (stringp time)
--
2.28.0
next reply other threads:[~2020-08-18 22:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 22:16 No Wayman [this message]
2020-09-05 15:59 ` [PATCH] org-add-planning-info: respect caller's given time [9.3.7 (release_9.3.7-716-g3d4876 @ /home/n/.emacs.d/straight/build/org/)] Bastien
2020-09-05 16:13 ` No Wayman
2020-09-06 5:54 ` Bastien
2020-09-06 10:03 ` Bastien
2020-09-07 16:22 ` No Wayman
2020-09-08 4:49 ` Kyle Meyer
2020-09-08 14:23 ` Jack Kamm
2020-09-09 4:37 ` No Wayman
2020-09-09 4:49 ` Kyle Meyer
2020-09-09 13:37 ` Jack Kamm
2020-09-09 4:40 ` No Wayman
2020-09-08 8:29 ` Bastien
2020-09-09 4:37 ` No Wayman
2020-09-09 10:29 ` Bastien
2020-09-09 17:52 ` No Wayman
2020-09-10 17:11 ` No Wayman
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=87zh6rfvmi.fsf@gmail.com \
--to=iarchivedmywholelife@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).