[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] bulk relative time shift (in org file)?
From: |
Memnon Anon |
Subject: |
Re: [O] bulk relative time shift (in org file)? |
Date: |
Sat, 16 Jul 2011 18:00:05 +0000 (UTC) |
Bastien <address@hidden> writes:
> My Gnus .overview has been corrupted and I lost track of the question.
> Can you restate it shortly here?
,----[ Original request as short as I can get it ]
| Michael is looking for a way to "bulk re'timestamp'" items
| relativ to the timestamp the item has currently.
| This should work on region, subtree etc.
| He wants to avoid cloning and would prefer doing this
| directly in the file, not with the agenda.
`----
Example:
--8<---------------cut here---------------start------------->8---
Before:
* Project A
** Task A
SCHEDULED: <2011-07-16 Sa>
** Taks B
SCHEDULED: <2011-07-19 Di>
** Task C
SCHEDULED: <2011-07-21 Do>
After "Bulk re-timestamp schedule +7d scope subtree" :
* Project A
** Task A
SCHEDULED: <2011-07-23 Sa>
** Taks B
SCHEDULED: <2011-07-26 Di>
** Task C
SCHEDULED: <2011-07-28 Do>
--8<---------------cut here---------------end--------------->8---
I said that the agenda seems to me the easiest way to do it.
>But the agenda is in many ways another interface to the org file.
(i.e. Agenda can be more than a calendar like presentation)
>And it supports limiting to: Region, Subtree, etc.
out of the box!
Prototype bulkshift by date:
#+begin_src emacs-lisp
(defun my-org-bulkshift-deadline ()
"Shift the deadline of marked items in the agenda by
n days. Set n via Prefix Arg!"
(interactive "P")
(let* ((marker (or (org-get-at-bol 'org-hd-marker)
(org-agenda-error)))
(buffer (marker-buffer marker)))
(with-current-buffer buffer
(save-excursion
(save-restriction
(widen)
(goto-char marker)
(org-back-to-heading t)
(when (and (org-entry-get (point) "DEADLINE") ; There is a deadline
there
(numberp current-prefix-arg)) ; And
current-prefix-arg is a number
(re-search-forward org-deadline-time-regexp)
(org-timestamp-change current-prefix-arg 'day)))))))
#+end_src
Use: "M-15 B f my-org-bul<TAB>"
in the agenda (limited to what you want, then marking the items.)
> I did only minimal testing so far, but the prototype
> seems to work and my-org-bulkshift-scheduled, -plain et al. can be easily
> added and/or combined into one function.
Memnon "This is not really short :(" Anon