emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Memnon Anon <gegendosenfleisch@googlemail.com>
To: emacs-orgmode@gnu.org
Subject: Scheduling time+effort or (ab-?)using org-agenda-default-duration
Date: Tue, 19 Jun 2012 19:26:31 +0000 (UTC)	[thread overview]
Message-ID: <878vfj180y.fsf@mean.albasani.net> (raw)

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

                 reply	other threads:[~2012-06-19 19:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=878vfj180y.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).