Re: [O] bulk relative time shift (in org file)?

2011-07-28 Thread Memnon Anon
Michael C Gilbert  writes:

> Ideally, something like this should be available in the org file,
> rather than in the agenda. [...]
>
> But if I shift back and forth to the agenda, then I can make this
> work. I'm assuming that the 'Cc C-s' and 'C-c C-d' commands don't work
> on regions or on everything under a heading?

It may be feasible to make scheduling and deadlining act on region;
lets wait what Bastien thinks when he is back from well
deserved vacation.

I have been experimenting to get this done with a simple function
one could bind to e.g. `C-s M-s'. (Or one could defadvice
the proper functions (?), I have to read up on that ...)

In my first tests, it somewhat works, but the logbook
is updated only on the last item, not sure why that is, yet.

I will investigate later if no one jumps in and improves/replaces
this prototype:

--8<---cut here---start->8---
(defun my-org-schedule-shift ()
  (interactive)
  (let* ((acton (if (org-region-active-p) "region" 
  "tree"))
 (val (read-string (concat "shift "acton" by: "
(if (equal acton "region")
(org-map-region '(lambda () 
   (org-schedule nil val)) (region-beginning) 
(region-end))
  (org-map-tree '(lambda () 
   (org-schedule nil val))

(defun my-org-schedule-shift-region ()
  (interactive)
  (let ((val (read-string "Shift region by: ")))
   (org-map-region '(lambda () 
  (org-schedule nil val)) (region-beginning) (region-end

(defun my-org-schedule-shift-tree ()
  (interactive)
  (let ((val (read-string "Shift region by: ")))
   (org-map-tree '(lambda () 
  (org-schedule nil val)
--8<---cut here---end--->8---

Memnon




Re: [O] bulk relative time shift (in org file)?

2011-07-27 Thread Michael C Gilbert
On Jul 26, 2011, at 12:44 PM, Memnon Anon wrote:

>  Bastien  writes:
> 
>> On an item, `C-c C-s' and `C-c C-d' now allows you to use
>> "+2d" to say "schedule in 2 days from today" or "++2d" to 
>> say "schedule in 2 days from existing timestamp".
>> 
>> In agenda, `B s' and `B d' will also understand this and
>> let you reschedule/redeadline items relatively.
>> 
>> Let me know if this works okay for you -- and thanks for
>> bringing this up again!
> 
> "++" looks very useful! I pinged Michael who started this thread, I hope 
> we'll get an update
> on his perspective. 

I missed the ++ usage in this context completely. Yes, this gets me close to 
what I was looking for.

Ideally, something like this should be available in the org file, rather than 
in the agenda. The reason being is that it is a common project planning task to 
shift all related tasks back by some set period of time. I can see expanding 
the notion to take dependencies into account, but that is not critical. I'm 
just looking for a way to do this routine in the project management & planning 
contexts in my own work and in my organization

But if I shift back and forth to the agenda, then I can make this work. I'm 
assuming that the 'Cc C-s' and 'C-c C-d' commands don't work on regions or on 
everything under a heading?

— Michael




Re: [O] bulk relative time shift (in org file)?

2011-07-26 Thread Memnon Anon
Hi Bastien,

Bastien  writes:

> On an item, `C-c C-s' and `C-c C-d' now allows you to use
> "+2d" to say "schedule in 2 days from today" or "++2d" to 
> say "schedule in 2 days from existing timestamp".
>
> In agenda, `B s' and `B d' will also understand this and
> let you reschedule/redeadline items relatively.
>
> Let me know if this works okay for you -- and thanks for
> bringing this up again!

"++" looks very useful!

I pinged Michael who started this thread, I hope we'll get an update
on his perspective. 

Thanks alot!

Memnon





Re: [O] bulk relative time shift (in org file)?

2011-07-24 Thread Bastien
Hi Memnon,

Memnon Anon  writes:

> ,[ 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.
> `

This is now feasible as a general feature for org-schedule 
and org-deadline.

On an item, `C-c C-s' and `C-c C-d' now allows you to use
"+2d" to say "schedule in 2 days from today" or "++2d" to 
say "schedule in 2 days from existing timestamp".

In agenda, `B s' and `B d' will also understand this and
let you reschedule/redeadline items relatively.

Let me know if this works okay for you -- and thanks for
bringing this up again!

-- 
 Bastien



Re: [O] bulk relative time shift (in org file)?

2011-07-16 Thread Memnon Anon
Bastien  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" 
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




Re: [O] bulk relative time shift (in org file)?

2011-07-16 Thread Bastien
Hi Memnon,

Memnon Anon  writes:

>>> Any guidance?
>> Oh, guidance would be great: I'm curious what others will propose.
>
> Anyone?
> This question might have gone down in the prerelease turmoil ...

My Gnus .overview has been corrupted and I lost track of the question.

Can you restate it shortly here?

Thanks!

-- 
 Bastien



Re: [O] bulk relative time shift (in org file)?

2011-07-12 Thread Memnon Anon
Hi,

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

Anyone?
This question might have gone down in the prerelease turmoil ...

Memnon




Re: [O] bulk relative time shift (in org file)?

2011-06-30 Thread Memnon Anon
Hi Michael,

Michael Gilbert  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
deadlines:

--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)
 (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)))
--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 ark 'em up
and do "M-15 B f my-org-bul" 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




[O] bulk relative time shift (in org file)?

2011-06-30 Thread Michael Gilbert
Hi —

I've spent a fair amount of time with the manual and have hints that this might 
be possible, but I'm not piecing it together. Basically what I want to do is 
this:

- 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

Additional points:

- I would prefer to select the type of timestamp to change, but I can probably 
work with it changing all of them. (Note that some items have both Scheduled 
and Deadline timestamps. Some even have other, inactive timestamps. Plus, there 
are also timestamps in the Logbook on some items.)
- I would prefer to do this in the org file, not in the Agenda. This is a 
planning activity.
- I can see how I might do this by cloning the subtree, but that seems like an 
ugly hack, involving deleting the original.

Any guidance?

TIA!

— Michael


The Gilbert Center: http://gilbert.org
Nonprofit News: http://nonprofitnews.org