<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/assets/rss.xsl" type="text/xsl"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"

>
<channel>
	<title>Sacha Chua - tag - tasks</title>
	<atom:link href="https://sachachua.com/blog/tag/tasks/feed/index.xml" rel="self" type="application/rss+xml" />
	<atom:link href="https://sachachua.com/blog/tag/tasks" rel="alternate" type="text/html" />
	<link>https://sachachua.com/blog/tag/tasks/feed/index.xml</link>
	<description>Emacs, sketches, and life</description>
  
	<lastBuildDate>Wed, 13 May 2026 14:32:18 GMT</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>daily</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>11ty</generator>
  <item>
		<title>A day in a life with Org</title>
		<link>https://sachachua.com/blog/2007/12/a-day-in-a-life-with-org/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sun, 23 Dec 2007 00:20:00 GMT</pubDate>
    <category>emacs</category>
<category>org</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4527</guid>
		<description><![CDATA[<p>I spend most of my day working on or near a computer: writing,<br>
replying to e-mail, making phone calls, and so on. I use Lotus Notes<br>
for my calendar because people need to be able to check my<br>
availability for meetings. I use Emacs to keep track of what I need to<br>
do, because it makes planning my day so much easier.</p>
<p>The first thing I do each morning is quickly go through my e-mail<br>
looking for action items.  Instead of leaving them in my mail inbox, I<br>
create tasks for each of the items in my Org to-do list.  I add notes<br>
so that I don&#8217;t have to find the e-mails again. I also add other tasks<br>
that come to mind. I add time estimates whenever I can.</p>
<p>This step is also a good time to review my personal objectives and<br>
proactively set myself some tasks so that I can move towards them. For<br>
example, if I want to learn more about career growth, I can&#8217;t wait for<br>
e-mail from someone else telling me what to do. I have to think of<br>
something to do, and build time into my day in order to do it. I put<br>
all those tasks into my task inbox, which is just a header at the<br>
bottom of my task list, like this:</p>
<p>(remove the leading space)</p>
<pre class="example">
 * Inbox
 ** TODO ....
 ** TODO ....
</pre>
<p>Now that I&#8217;ve captured all these tasks, I review my day. What are my<br>
appointments?  What items are due today? I double-check this against<br>
my official calendar to make sure I haven&#8217;t missed any<br>
appointments. After I make sure that the important tasks and<br>
appointments are there, I start filling in gaps, scheduling some of my<br>
important-but-not-urgent tasks onto today.</p>
<p>After I&#8217;ve decided what to do that day, I review the rest of the<br>
week. Does my workload look reasonable? Are there upcoming deadlines?<br>
I try to make sure that all of my inbox items have scheduled dates.  I<br>
also review my list of waiting tasks to see if I need to follow up<br>
with anyone.</p>
<p>After I&#8217;ve gotten the tasks all down and scheduled, it&#8217;s easy to<br>
organize them under the appropriate headings. Billable tasks are filed<br>
under the projects they belong to, and unbilled tasks are categorized<br>
by how I need to report them and how I organize them into personal<br>
projects. Organizing tasks into categories AFTER I schedule them means<br>
less jumping around looking for unscheduled tasks.</p>
<p>This process (e-mail scan and daily and weekly overview) takes me<br>
around 15 minutes, and helps keep me sane.</p>
<p>I try to keep my mornings free for creative brainstorming and heavy<br>
lifting. Once I&#8217;ve reviewed my plans for the day and the week, I pick<br>
a task and work on it for an hour or so. When I mark the task as<br>
STARTED (&#8220;t&#8221; or &#8220;C-u t&#8221; from the Org agenda view), the clock<br>
automatically starts ticking. When I mark the task as WAITING or DONE,<br>
the clock automatically stops. Org timeclocking makes it easier for me<br>
to report my hours at the end of each week. I can also compare the<br>
actual times against my estimates, helping me improve my accuracy.</p>
<p>This process is my morning ritual: putting tasks into my Org agenda,<br>
organizing them, reviewing and planning from my calendar, and then<br>
getting started by working on something useful _before_ I spend time<br>
catching up with the blogosphere or responding to my mail. It&#8217;s<br>
complemented by my afternoon ritual of reviewing my completed tasks<br>
with the Org agenda logbook and possibly blogging about some lessons<br>
learned.</p>
<p>Here&#8217;s how you can use Org to do the same, assuming that you&#8217;ve set it<br>
up already.</p>
<p>Morning ritual:</p>
<p>*Read your e-mail and create tasks.* Open your Org file. If it&#8217;s not yet in your Org agenda list, add it with C-c [ (org-agenda-file-to-front).</p>
<p>You can jump to the end of the file using M-&gt; (end-of-buffer) and<br>
add tasks just by typing &#8220;** TODO &#8221; and the task name. If you read<br>
e-mail in Emacs (and there are plenty of good reasons to do so!), you<br>
can set up Remember Mode to make it easy to create hyperlinked tasks<br>
from mail and other sources.  Use C-c C-d (org-deadline) to note<br>
deadlines for the current task, and use C-c C-s (org-schedule) to note<br>
when a task needs to be done on a certain date.</p>
<p>*Review your projects and create tasks.* Tag projects like this:</p>
<pre class="example">
 ** Learn about career options within the company     :PROJECT:
</pre>
<p>Then you can use a custom agenda view to see your agenda for today, your projects, and other useful information.<br>
Here&#8217;s something you can add to your ~/.emacs:</p>
<pre class="example">
(global-set-key (kbd "C-c a") 'org-agenda)
(setq org-agenda-custom-commands
      '(("a" "My custom agenda"
	 ((org-agenda-list nil nil 1)
	  (tags "PROJECT-WAITING")
	  (tags-todo "WAITING")
	  (tags-todo "-MAYBE")))))
</pre>
<p>You can then use C-c a a (org-agenda, custom command) to get an overview of your day/week, your<br>
current projects, your WAITING tasks, and your active tasks.</p>
<p>*Review your day.* Use C-c a a (org-agenda, custom command) to see<br>
your appointments for the day, and open your Org file in another<br>
buffer. Use C-c C-s (org-schedule) in your Org file to schedule some<br>
of your inbox tasks for the day and some of your tasks for other days<br>
in the week.  You can use Shift-right and Shift-left to reschedule<br>
tasks from the agenda view. Use &#8220;w&#8221; in the agenda to switch to a<br>
weekly view, and &#8220;d&#8221; to switch to a daily view.</p>
<p>If you want to see how your time estimates fit into your workday with<br>
a load estimate like this:</p>
<pre class="example">
15.8% load: 90 minutes to be scheduled, 570 minutes free, 480 minutes gap
</pre>
<p>add estimated number of minutes to your tasks like this:</p>
<pre class="example">
** TODO 60 Browse through a book
** TODO 15 Scan my RSS feeds
</pre>
<p>and use the following code in your ~/.emacs:</p>
<pre class="example">
(defun sacha/org-show-load ()
  "Show my unscheduled time and free time for the day."
  (interactive)
  (let ((time (sacha/org-calculate-free-time
               ;; today
               (calendar-gregorian-from-absolute (time-to-days (current-time)))
               ;; now
               (let* ((now (decode-time))
                      (cur-hour (nth 2 now))
                      (cur-min (nth 1 now)))
                 (+ (* cur-hour 60) cur-min))
               ;; until the last time in my time grid
               (let ((last (car (last (elt org-agenda-time-grid 2)))))
                 (+ (* (/ last 100) 60) (% last 100))))))
    (message "%.1f%% load: %d minutes to be scheduled, %d minutes free, %d minutes gap\n"
            (/ (car time) (* .01 (cdr time)))
            (car time)
            (cdr time)
            (- (cdr time) (car time)))))

(defun sacha/org-agenda-load (match)
  "Can be included in `org-agenda-custom-commands'."
  (let ((inhibit-read-only t)
        (time (sacha/org-calculate-free-time
               ;; today
               (calendar-gregorian-from-absolute org-starting-day)
               ;; now if today, else start of day
               (if (= org-starting-day
                      (time-to-days (current-time)))
                   (let* ((now (decode-time))
                          (cur-hour (nth 2 now))
                          (cur-min (nth 1 now)))
                     (+ (* cur-hour 60) cur-min))
                 (let ((start (car (elt org-agenda-time-grid 2))))
                   (+ (* (/ start 100) 60) (% start 100))))
                 ;; until the last time in my time grid
               (let ((last (car (last (elt org-agenda-time-grid 2)))))
                 (+ (* (/ last 100) 60) (% last 100))))))
    (goto-char (point-max))
    (insert (format
             "%.1f%% load: %d minutes to be scheduled, %d minutes free, %d minutes gap\n"
             (/ (car time) (* .01 (cdr time)))
             (car time)
             (cdr time)
             (- (cdr time) (car time))))))

(defun sacha/org-calculate-free-time (date start-time end-of-day)
  "Return a cons cell of the form (TASK-TIME . FREE-TIME) for DATE, given START-TIME and END-OF-DAY.
DATE is a list of the form (MONTH DAY YEAR).
START-TIME and END-OF-DAY are the number of minutes past midnight."
  (save-window-excursion
  (let ((files org-agenda-files)
        (total-unscheduled 0)
        (total-gap 0)
        file
        rtn
        rtnall
        entry
        (last-timestamp start-time)
        scheduled-entries)
    (while (setq file (car files))
      (catch 'nextfile
        (org-check-agenda-file file)
        (setq rtn (org-agenda-get-day-entries file date :scheduled :timestamp))
        (setq rtnall (append rtnall rtn)))
      (setq files (cdr files)))
    ;; For each item on the list
    (while (setq entry (car rtnall))
      (let ((time (get-text-property 1 'time entry)))
        (cond
         ((and time (string-match "\\([^-]+\\)-\\([^-]+\\)" time))
          (setq scheduled-entries (cons (cons
                                         (save-match-data (appt-convert-time (match-string 1 time)))
                                         (save-match-data (appt-convert-time (match-string 2 time))))
                                        scheduled-entries)))
         ((and time
               (string-match "\\([^-]+\\)\\.+" time)
               (string-match "^[A-Z]+ \\(\\[#[A-Z]\\]\\)? \\([0-9]+\\)" (get-text-property 1 'txt entry)))
          (setq scheduled-entries
                (let ((start (and (string-match "\\([^-]+\\)\\.+" time)
                                 (appt-convert-time (match-string 1 time)))))
                  (cons (cons start
                              (and (string-match "^[A-Z]+ \\(\\[#[A-Z]\\]\\)? \\([0-9]+\\) " (get-text-property 1 'txt entry))
                                   (+ start (string-to-number (match-string 2 (get-text-property 1 'txt entry))))))
                        scheduled-entries))))
         ((string-match "^[A-Z]+ \\([0-9]+\\)" (get-text-property 1 'txt entry))
          (setq total-unscheduled (+ (string-to-number
                                      (match-string 1 (get-text-property 1 'txt entry)))
                                     total-unscheduled)))))
      (setq rtnall (cdr rtnall)))
    ;; Sort the scheduled entries by time
    (setq scheduled-entries (sort scheduled-entries (lambda (a b) (< (car a) (car b)))))

    (while scheduled-entries
      (let ((start (car (car scheduled-entries)))
            (end (cdr (car scheduled-entries))))
      (cond
       ;; are we in the middle of this timeslot?
       ((and (>= last-timestamp start)
             (< = last-timestamp end))
        ;; move timestamp later, no change to time
        (setq last-timestamp end))
       ;; are we completely before this timeslot?
       ((< last-timestamp start)
        ;; add gap to total, skip to the end
        (setq total-gap (+ (- start last-timestamp) total-gap))
        (setq last-timestamp end)))
      (setq scheduled-entries (cdr scheduled-entries))))
    (if (< last-timestamp end-of-day)
        (setq total-gap (+ (- end-of-day last-timestamp) total-gap)))
    (cons total-unscheduled total-gap))))
</pre>
<p>Then you can add it to your custom agenda by using this in your ~/.emacs:</p>
<pre class="example">
;; Change your existing org-agenda-custom-commands
(setq org-agenda-custom-commands
      '(("a" "My custom agenda"
	 ((org-agenda-list nil nil 1)
          (sacha/org-agenda-load)    ; ADD THIS LINE
	  (tags "PROJECT-WAITING")
	  (tags-todo "WAITING")
	  (tags-todo "-MAYBE")))))
</pre>
<p>*Organize your inbox.* Now that you&#8217;ve scheduled your tasks, move them<br>
under the appropriate headings.  You can use TAB to collapse a task<br>
into a single line, then C-k (kill-line) to cut it and C-y to paste it<br>
elsewhere. I like using C-r (isearch-backward) to search for the right<br>
place in the file.</p>
<p>*Get to work!* You may find it useful to have four states for a task: TODO, STARTED, WAITING, and DONE.<br>
It&#8217;s also handy to type in a note when you mark a task as done. To set that up, just add the following to the beginning of your Org file:</p>
<pre class="example">
#+STARTUP: lognotedone
#+SEQ_TODO: TODO STARTED WAITING DONE
</pre>
<p>Then you can use &#8220;t&#8221; (org-todo) from the Org agenda view or C-c C-t<br>
(org-todo) from the Org file to mark a TODO task as STARTED, or to<br>
move from one state to the other. To move to a specific state (DONE<br>
from STARTED, for example), either edit it directly or use C-u before<br>
the org-todo command.</p>
<p>Use the following code to automatically clock in when you start a<br>
task, start a task when you clock in, and clock out of a task when you<br>
mark it as waiting.</p>
<pre class="example">
(defun sacha/org-clock-in-if-starting ()
  "Clock in when the task is marked STARTED."
  (when (and (string= state "STARTED")
             (not (string= last-state state)))
    (org-clock-in)))
(add-hook 'org-after-todo-state-change-hook
	  'sacha/org-clock-in-if-starting)
(defadvice org-clock-in (after sacha activate)
  "Set this task's status to 'STARTED'."
  (org-todo "STARTED"))

(defun sacha/org-clock-out-if-waiting ()
  "Clock in when the task is marked STARTED."
  (when (and (string= state "WAITING")
             (not (string= last-state state)))
    (org-clock-out)))
(add-hook 'org-after-todo-state-change-hook
	  'sacha/org-clock-out-if-waiting)
</pre>
<p>*Review your accomplishments at the end of the day.* You can use the<br>
Org agenda logbook to see all your completed tasks. From an Org agenda<br>
view such as the custom one you set up for C-c a a, type &#8220;l&#8221;<br>
(lowercase L). You can then see your completed TODOs.</p>
<p>To review your time usage, you can use C-c C-x C-d (org-clock-display)<br>
from an Org buffer to see time totals according to the tree, or you<br>
can add a table to your custom agenda view. Add the following to your<br>
~/.emacs:</p>
<pre class="example">
(defun sacha/org-agenda-clock (match)
  ;; Find out when today is
  (let* ((inhibit-read-only t))
    (goto-char (point-max))
    (org-dblock-write:clocktable
     `(:scope agenda
       :maxlevel 4
       :tstart ,(format-time-string "%Y-%m-%d" (calendar-time-from-absolute (1+ org-starting-day) 0))
       :tend ,(format-time-string "%Y-%m-%d" (calendar-time-from-absolute (+ org-starting-day 2) 0))))))
</pre>
<p>and then add sacha/org-agenda-clock to your custom agenda in<br>
org-agenda-custom-commands in your ~/.emacs file, like this:</p>
<pre class="example">
;; Change your existing org-agenda-custom-commands
(setq org-agenda-custom-commands
      '(("a" "My custom agenda"
	 ((org-agenda-list nil nil 1)
          (sacha/org-agenda-load)
          (sacha/org-agenda-clock)    ; Add this line
	  (tags "PROJECT-WAITING")
	  (tags-todo "WAITING")
	  (tags-todo "-MAYBE")))))
</pre>
<p>You can then use C-c a a (org-agenda, custom command) to see a table summarizing your clocked-in time for that day.</p>
<p>END RESULT: You can add tasks, quickly get an overview of your day and<br>
week, reschedule tasks until you&#8217;ve got a realistic load, keep track<br>
of your progress, and review your accomplishments.</p>
<p>Org keeps me sane. =) The code above only looks like a lot of customization, but it&#8217;s well worth it.</p>
<p>Next, I&#8217;m going to figure out how to calculate my velocity, or estimated time divided by actual time taken&#8230; =)</p>
<p>(Thanks to <a href="http://www.petebevin.com/">Pete Bevin</a> for catching a typo! =) )</p>

<p>Random Emacs symbol: floor &#8211; Function: Return the largest integer no greater than ARG.</p>

<p>You can <a href="https://sachachua.com/blog/2007/12/a-day-in-a-life-with-org/#comment">view 4 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2007%2F12%2Fa-day-in-a-life-with-org%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Finding out if I&#8217;m overscheduled</title>
		<link>https://sachachua.com/blog/2007/12/finding-out-if-im-overscheduled/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sat, 08 Dec 2007 18:09:00 GMT</pubDate>
    <category>emacs</category>
<category>org</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4494</guid>
		<description><![CDATA[<p>If you&#8217;re anything like me, your task list is long and growing, but<br>
the time you have is just as fixed. How do you manage that? I handle<br>
that problem by looking at my calendar and my task list together when<br>
I&#8217;m planning my day. I tend to be too optimistic about my tasks,<br>
trying to schedule more into my day than I should. Fortunately, Emacs<br>
can help me make sure I don&#8217;t overcommit. Here&#8217;s how it works.</p>
<p>When I create and schedule tasks, I try my best to add time estimates.<br>
The numbers in the TODO headline represent minutes.</p>
<pre class="example">
* TODO 15 Announce tea party
  SCHEDULED: &lt;2007-12-08 Sat&gt;
* DONE 30 Drop letters off at post office
  SCHEDULED: &lt;2007-12-08 Sat&gt;
* TODO 60 Write blog post about tasks
  SCHEDULED: &lt;2007-12-08 Sat&gt;
* TODO 60 Make book notes
  SCHEDULED: &lt;2007-12-09 Sun&gt;
* TODO 30 Start on my letter for 2007
  SCHEDULED: &lt;2007-12-08 Sat&gt;
* TODO 60 Follow up with DemoCamp contacts
  SCHEDULED: &lt;2007-12-08 Sat&gt;
  DEADLINE: &lt;2007-12-09 Sun&gt;
* TODO 60 Respond to mail
  SCHEDULED: &lt;2007-12-08 Sat&gt;
</pre>
<p>Then my custom agenda view looks like this:</p>
<pre class="example">
Day-agenda:
Saturday   8 December 2007
  6:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
  8:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
 10:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
 12:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
 14:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
 14:00-17:15  Scheduled:  TODO Take another driving lesson - emergency stuff
 16:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
 18:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
 20:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
 22:00......  &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;
              In   1 d.:  TODO 60 Follow up with DemoCamp contacts
              Scheduled:  TODO 15 Announce tea party
              Scheduled:  TODO 60 Write blog post about tasks
              Scheduled:  TODO 30 Start on my letter for 2007
              Scheduled:  TODO 60 Follow up with DemoCamp contacts
              Scheduled:  TODO 60 Respond to mail
              In 937 d.:  101 things in 1001 days
62.7% load: 225 minutes to be scheduled, 359 minutes free, 134 minutes gap
</pre>
<p>I&#8217;ll need to figure out over the next few weeks what kind of a load<br>
threshold is good (you really don&#8217;t want to try for 100%), but at<br>
least it&#8217;s visible!</p>
<pre class="example">
(setq org-agenda-custom-commands
      '(("i" "My agenda"
         ((org-agenda-list nil nil 1)
          (sacha/org-load)))
        ;; ... other stuff goes here
      ))

(defun sacha/org-show-load ()
  "Show my unscheduled time and free time for the day."
  (interactive)
  (let ((time (sacha/org-calculate-free-time
               ;; today
               (calendar-gregorian-from-absolute (time-to-days (current-time)))
               ;; now
               (let* ((now (decode-time))
                      (cur-hour (nth 2 now))
                      (cur-min (nth 1 now)))
                 (+ (* cur-hour 60) cur-min))
               ;; until the last time in my time grid
               (let ((last (car (last (elt org-agenda-time-grid 2)))))
                 (+ (* (/ last 100) 60) (% last 100))))))
    (message "%.1f%% load: %d minutes to be scheduled, %d minutes free, %d minutes gap"
            (/ (car time) (* .01 (cdr time)))
            (car time)
            (cdr time)
            (- (cdr time) (car time)))))

(defun sacha/org-load (match)
  "Can be included in `org-agenda-custom-commands'."
  (let ((inhibit-read-only t)
        (time (sacha/org-calculate-free-time
               ;; today
               (calendar-gregorian-from-absolute org-starting-day)
               ;; now if today, else start of day
               (if (= org-starting-day
                      (time-to-days (current-time)))
                   (let* ((now (decode-time))
                          (cur-hour (nth 2 now))
                          (cur-min (nth 1 now)))
                     (+ (* cur-hour 60) cur-min))
                 (let ((start (car (elt org-agenda-time-grid 2))))
                   (+ (* (/ start 100) 60) (% start 100))))
                 ;; until the last time in my time grid
               (let ((last (car (last (elt org-agenda-time-grid 2)))))
                 (+ (* (/ last 100) 60) (% last 100))))))
    (goto-char (point-max))
    (insert (format
             "%.1f%% load: %d minutes to be scheduled, %d minutes free, %d minutes gap"
             (/ (car time) (* .01 (cdr time)))
             (car time)
             (cdr time)
             (- (cdr time) (car time))))))

(defun sacha/org-calculate-free-time (date start-time end-of-day)
  "Return a cons cell of the form (TASK-TIME . FREE-TIME) for DATE, given START-TIME and END-OF-DAY.
DATE is a list of the form (MONTH DAY YEAR).
START-TIME and END-OF-DAY are the number of minutes past midnight."
  (save-window-excursion
  (let ((files org-agenda-files)
        (total-unscheduled 0)
        (total-gap 0)
        file
        rtn
        rtnall
        entry
        (last-timestamp start-time)
        scheduled-entries)
    (while (setq file (car files))
      (catch 'nextfile
        (org-check-agenda-file file)
        (setq rtn (org-agenda-get-day-entries file date :scheduled :timestamp))
        (setq rtnall (append rtnall rtn)))
      (setq files (cdr files)))
    ;; For each item on the list
    (while (setq entry (car rtnall))
      (let ((time (get-text-property 1 'time entry)))
        (cond
         ((and time (string-match "\\([^-]+\\)-\\([^-]+\\)" time))
          (setq scheduled-entries (cons (cons
                                         (save-match-data (appt-convert-time (match-string 1 time)))
                                         (save-match-data (appt-convert-time (match-string 2 time))))
                                        scheduled-entries)))
         ((and time
               (string-match "\\([^-]+\\)\\.+" time)
               (string-match "^[A-Z]+ \\([0-9]+\\)" (get-text-property 1 'txt entry)))
          (setq scheduled-entries
                (let ((start (and (string-match "\\([^-]+\\)\\.+" time)
                                 (appt-convert-time (match-string 1 time)))))
                  (cons (cons start
                              (and (string-match "^[A-Z]+ \\([0-9]+\\)" (get-text-property 1 'txt entry))
                                   (+ start (string-to-number (match-string 1 (get-text-property 1 'txt entry))))))
                        scheduled-entries))))
         ((string-match "^[A-Z]+ \\([0-9]+\\)" (get-text-property 1 'txt entry))
          (setq total-unscheduled (+ (string-to-number
                                      (match-string 1 (get-text-property 1 'txt entry)))
                                     total-unscheduled)))))
      (setq rtnall (cdr rtnall)))
    ;; Sort the scheduled entries by time
    (setq scheduled-entries (sort scheduled-entries (lambda (a b) (&lt; (car a) (car b)))))

    (while scheduled-entries
      (let ((start (car (car scheduled-entries)))
            (end (cdr (car scheduled-entries))))
      (cond
       ;; are we in the middle of this timeslot?
       ((and (&gt;= last-timestamp start)
             (&lt;= last-timestamp end))
        ;; move timestamp later, no change to time
        (setq last-timestamp end))
       ;; are we completely before this timeslot?
       ((&lt; last-timestamp start)
        ;; add gap to total, skip to the end
        (setq total-gap (+ (- start last-timestamp) total-gap))
        (setq last-timestamp end)))
      (setq scheduled-entries (cdr scheduled-entries))))
    (if (&lt; last-timestamp end-of-day)
        (setq total-gap (+ (- end-of-day last-timestamp) total-gap)))
    (cons total-unscheduled total-gap))))
</pre>

<p>Random Emacs symbol: select-safe-coding-system-function &#8211; Variable: Function to call to select safe coding system for encoding a text.</p>

<p>You can <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2007%2F12%2Ffinding-out-if-im-overscheduled%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Optimizing your action loop</title>
		<link>https://sachachua.com/blog/2007/11/optimizing-your-action-loop/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Thu, 29 Nov 2007 03:48:01 GMT</pubDate>
    <category>emacs</category>
<category>org</category>
<category>planning</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4475</guid>
		<description><![CDATA[<p>If you want to be radically more effective at doing things, get better<br>
at deciding what to do. Few things are more personal than figuring out<br>
what you&#8217;re going to do with your life: at this moment, for this day,<br>
for the next few years. Few decisions are made as frequently. If you<br>
can improve the way you make that decision, you&#8217;ll reap the benefits<br>
everywhere.</p>
<p>We&#8217;ve all developed some ways of coping. We all have our quirks.<br>
One of mine is that I can&#8217;t settle on one way of planning my tasks.<br>
Some days, I&#8217;m all strategic and top-down, connecting my life goals<br>
with the tasks I plan to do that day. Other days, I just need to get a<br>
crucial task out of my head so that I don&#8217;t forget it while hunting<br>
for my keys. Some days, I block out time to work on my priority<br>
projects. Other days, I have to work around other people&#8217;s schedules,<br>
so it&#8217;s all about cramming whatever I can into whenever I&#8217;ve got.</p>
<p>Now think of all the other geeks out there, and you&#8217;ll understand how<br>
to-do list programs might outnumber programmers. Despite the<br>
collective efforts of companies like Microsoft and IBM, despite the<br>
coolness of Web 2.0 services like Remember the Milk, despite the<br>
renaissance of paper-based planners such as the Hipster PDA, I have<br>
never found anything as powerful as a plain text file in terms of<br>
personal productivity: a plain text file with shortcuts that are<br>
form-fitted to the way I work.</p>
<p>Here&#8217;s what my workday looks like:</p>
<ul>
<li>I do a _quick_ scan of e-mail to see if any tasks have come in. I copy those into my inbox. I resist the urge to reply right away, as that turns e-mail into a huge timesink.</li>
<li>5-10 minutes are enough to schedule and prioritize my tasks for the day. I see both my calendar and my task list at the same time, and I can estimate my load. I leave plenty of space for things that come up. I feel better when I finish my scheduled tasks and then cross off a few more, than when I don&#8217;t finish everything I planned and I have to postpone tasks to the next day.</li>
<li>I work on my highest-priority task for the day.</li>
<li>_Then_ I respond to e-mail.</li>
<li>Then I work through everything else in roughly 45-minute chunks, with some downtime in between to recharge my brain and take care of routine tasks.</li>
<li>My computer is set up to encourage me to take 10-second breaks every 5 minutes and 2.5 minute breaks every hour. The numbers are arbitrary, but the result feels good. This works out even better when I work from home: 2.5 minutes is just enough time to clear the sink, or to empty the dishwasher, or to start some tea&#8230;</li>
</ul>
<p>A plain text file keeps me all organized, thanks to the Org module for<br>
the Emacs text editor. The text file shows me what&#8217;s on my horizon and<br>
what&#8217;s on today&#8217;s schedule. The text file helps me deal with<br>
interruptions because it keeps track of what I was working on and what<br>
I need to do.</p>
<p>The text file even helps me learn more about myself and my skills<br>
through detailed time-tracking. Every time I start a task, the clock<br>
starts. Every time I mark a task as waiting or done, the clock stops,<br>
and the elapsed time is stored in the task. This helps me tune my time<br>
estimates and report time at the end of the week.</p>
<p>And it&#8217;s just amazing. I don&#8217;t feel that I waste a lot of time. I have<br>
a sense of progress. I can see the big picture, and things almost<br>
never fall through the cracks. (When they do, that&#8217;s because I hadn&#8217;t<br>
gotten around to putting them in my text file yet.) Sure, this still<br>
doesn&#8217;t give me enough time to do everything I want to do, but I don&#8217;t<br>
feel stressed out about it because I&#8217;m working well. From now on, most<br>
of the performance improvement will come from improving my skills and<br>
learning more.</p>
<p>If I can do this much as a new hire with a pretty nifty task<br>
management system, think about what you can do with all your<br>
experience. What _could_ you do if you spent less time fighting with<br>
your memory or with your TODO system, and more time making the<br>
difference you want to make?</p>

<p>Random Emacs symbol: edebug-stop &#8211; Command: Stop execution and do not continue.</p>

<p>You can <a href="https://sachachua.com/blog/2007/11/optimizing-your-action-loop/#comment">view 7 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2007%2F11%2Foptimizing-your-action-loop%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item>
	</channel>
</rss>