all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [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/)]
@ 2020-08-18 22:16 No Wayman
  2020-09-05 15:59 ` Bastien
  0 siblings, 1 reply; 17+ messages in thread
From: No Wayman @ 2020-08-18 22:16 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


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

end of thread, other threads:[~2020-09-10 17:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-18 22:16 [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/)] No Wayman
2020-09-05 15:59 ` 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

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.