3

I just started to get into using emacs org-mode, and was wondering if this is possible. I put the scheduled in brackets in the title as I am not specifically interested only in timestamps which are "scheduled" in an org-mode sense, but was hoping this would work with any timestamp. I imagine that I include something like the following in my .emacs

(setq org-log-note-headings '((state . "%s %t for %Q")))

where %Q should represent the day the task was actually scheduled, but have no idea what I would have to use here (and if this is possible at all). In the org file I would then have a entry like

* TODO My task
  Next occurrence:
  <2015-10-02 Fri +1d>

which should when changing the state to DONE change to

* TODO My task
  - "DONE" [2015-09-30] for <2015-10-02 Fri>
    Notes on this...
  Next occurrence: 
  <2015-10-03 Sat +1d>

An alternative I would also be happy with would be to have a function that shifts a recurring time stamp once by its rule (so in this case by one day) and inserts the corresponding note at the beginning so which would simply change the first example to

* TODO My task
  - <2015-10-02> ...
  Next occurrence:
  <2015-10-03 Sat +1d>

but here I have no idea how to start... Any suggestions appreciated.

Update: Ok, based on this: How to make org prompt for a timestamp, when changing state of a TODO?

I achieved a behaviour close to what I was looking for, using two functions

(defun org-todo-with-deadline (&optional arg)
  (interactive "P")
  (cl-letf* ((my-current-time (org-get-deadline-time nil))
            ((symbol-function #'org-current-effective-time)
             #'(lambda () my-current-time)))
    (org-todo arg)
    )) 

(defun org-todo-with-schedule (&optional arg)
  (interactive "P")
  (cl-letf* ((my-current-time (org-get-scheduled-time nil))
            ((symbol-function #'org-current-effective-time)
             #'(lambda () my-current-time)))
    (org-todo arg)
    )) 

at least this works for SCHEDULED and DEADLINE marked entries, respectively. The downside is that it is not possible anymore to include the date when the state is changed (because this is temporally overwritten here) and it does not work with plain timestamps.

  • About `org-log-note-headings` the manual says: "In fact, it is not a good idea to change the ‘state’ entry, because Agenda Log mode depends on the format of these entries." – erikstokes Dec 22 '15 at 15:17
  • Thanks for this comment. I think I am rarely (well, not at all) using this mode, and I am not sure If the update I gave would have this problem (It does not necessarily change the state entry, though it changes the input for it). As said, this is only the first thing I came up with, and I would also appreciate any other thoughts on how to achieve the desired (or a similar) behaviour. – Dr.AbeNickIanEdLewis Dec 31 '15 at 09:55

0 Answers0