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: Fri, 1 Jul 2011 03:36:04 +0000 (UTC)	[thread overview]
Message-ID: <871uyaogg9.fsf@mean.albasani.net> (raw)
In-Reply-To: D922F8DC-6D01-450D-8E3B-43F623B02C75@gilbert.org

Hi Michael,

Michael Gilbert <mcg@gilbert.org> writes:

> - select a number of items with time stamps in an org file (either by
> region or, if I must, all items subsidiary to a headline) 
> - change all of their deadlines (or some other time stamp) by a set
> number of days, relative to the date they currently have - the result
> is a bulk rescheduling, with the relative timing of the items
> remaining intact

This is interesting! Elisp fun, where is my *scratch*?!

[Later ... much later]

When I heard Bulk rescheduling, I naturally turned to the agenda.
(To be honest, I would probably have tried another way if I had read
your mail more carefully the first time)

I know, you said:
> - I would prefer to do this in the org file, not in the Agenda. This
> is a planning activity.

But the agenda is in many ways another interface to the org file.
And it supports limiting to: Region, Subtree, etc.

So, based on the example in the manual, I made this prototype for

--8<---------------cut here---------------start------------->8---
(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)
	 (buffer (marker-buffer marker))
    (with-current-buffer buffer
	  (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)))))))
--8<---------------cut here---------------end--------------->8---

So, if you have a Project like this one:

* Proj a
** NEXT Task 1                  :TAGA:TAGB:
** TODO Task 2                  :TAGC:
** Task 3                       :TAGD:
** TODO [#A] Task 4						   
** TODO [#A] Task 5 						   

Use the agenda and its filtering and limiting support to 
a) limit to subtree, to region or limit to buffer
b) include/exlude TAGa/b/c
c) include/exclude state WAITING/NEXT/whatever
d) etc.etc.etc.
(and there are custom agendas as well :)

And when you have what you want, you just <m>ark 'em up
and do "M-15 B f my-org-bul<TAB>" and its done.

You can use many levels of filtering, but you don't have to of course.

Sleepy me 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.

Seems to me that using the agenda is the most flexible approach...

> Any guidance?

Oh, guidance would be great: I'm curious what others will propose.

Memnon "off to bed" Anon

  reply	other threads:[~2011-07-01  3:36 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 [this message]
2011-07-12 21:30   ` Memnon Anon
2011-07-16 17:10     ` Bastien
2011-07-16 18:00       ` Memnon Anon
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:

  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=871uyaogg9.fsf@mean.albasani.net \
    --to=gegendosenfleisch@googlemail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).