emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Scheduling time+effort or (ab-?)using org-agenda-default-duration
@ 2012-06-19 19:26 Memnon Anon
  0 siblings, 0 replies; only message in thread
From: Memnon Anon @ 2012-06-19 19:26 UTC (permalink / raw)
  To: emacs-orgmode

Hi org people,

I am trying to make my life a bit easier and would love some advice.

* Short:

Has anyone a little schedule/timestamp function which takes 
time of day (e.g. 10:20 or 10pm) and schedules/timestamps items 
as time+effort (e.g. 10:20+0:30)? 
A tiny change to org-agenda-format-item (s.b.) seems to work, but I am 
worried about side effects.

* Long:

Whenever new things come up, I quickly capture it, set a reasonable
effort and schedule it for tomorrow unless there is a cogent reason to do
otherwise. Each morning, I go through my daily agenda, do some
rescheduling if necessary and happily start ticking things of the list.
So far, I avoided setting specific time-slots for items.

However, I feel like it is time to test a different approach and
actually assign times. So I start with a bunch of items and want to
shuffle them around in the timetable, or rather sort them morning to
evening. I usually (always?!) finish items in one run, so it would 
be convenient to just enter a start time and get a timestamp with a
duration of starttime+effort. 

I had a look at the different functions involved, and bumped into 
`org-agenda-default-appointment-duration' (didn't know about that one)
which is used in `org-agenda-format-item' (and only there afaict).

#+begin_src emacs-lisp
;; Try to set s2 if s1 and `org-agenda-default-appointment-duration' are set
(when (and s1 (not s2) org-agenda-default-appointment-duration)
    (setq s2
          (org-minutes-to-hh:mm-string
	   (+ (org-hh:mm-string-to-minutes s1) org-agenda-default-appointment-duration))))
#+end_src

The easiest way to get the behavior I think I would like is a tiny
change like

#+begin_src emacs-lisp
;; Try to set s2 if s1 and `org-agenda-default-appointment-duration' are set
  (when (and s1 (not s2) org-agenda-default-appointment-duration)
    (if (org-get-effort) ; prefer effort over org-agenda-default-appointment-duration 
	(setq s2
	      (org-minutes-to-hh:mm-string
	       (+ (org-hh:mm-string-to-minutes s1) 
		  (org-duration-string-to-minutes (org-get-effort))))) 
      (setq s2
	    (org-minutes-to-hh:mm-string
	     (+ (org-hh:mm-string-to-minutes s1) org-agenda-default-appointment-duration)))))
#+end_src

... which seems to work afaict after very superficial testing.

Are there any side effects I missed?
Breaking org would seriously mess up my life :)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-19 19:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-19 19:26 Scheduling time+effort or (ab-?)using org-agenda-default-duration Memnon Anon

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