emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Memnon Anon <gegendosenfleisch@googlemail.com>
To: emacs-orgmode@gnu.org
Subject: Re: bulk relative time shift (in org file)?
Date: Sat, 16 Jul 2011 18:00:05 +0000 (UTC)	[thread overview]
Message-ID: <87y5zynmda.fsf@mean.albasani.net> (raw)
In-Reply-To: 87sjq6up5y.fsf@gnu.org

Bastien <bzg@altern.org> 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

  reply	other threads:[~2011-07-16 18:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-30 22:24 bulk relative time shift (in org file)? Michael Gilbert
2011-07-01  3:36 ` Memnon Anon
2011-07-12 21:30   ` Memnon Anon
2011-07-16 17:10     ` Bastien
2011-07-16 18:00       ` Memnon Anon [this message]
2011-07-24 16:06         ` Bastien
2011-07-26 19:44           ` Memnon Anon
2011-07-28  2:01             ` Michael C Gilbert
2011-07-28 15:47               ` Memnon Anon

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=87y5zynmda.fsf@mean.albasani.net \
    --to=gegendosenfleisch@googlemail.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).