 (defvar org-clock-start-time)
 (defvar dbus-path-emacs)
 (defvar dbus-interface-emacs)
+
+(defun pjones:org-parse-effort-tag (tag)
+  "Convert an effort TAG to a number of seconds."
+  (if (string-match "^\\([0-9]+\\)\\([mh]\\)$" tag)
+      (let ((num (string-to-number (match-string 1 tag)))
+            (mod (match-string 2 tag)))
+        (cond
+         ((string= mod "m") (* num 60))
+         ((string= mod "h") (* num 3600))
+         (t num)))
+    0))
+
+(defun pjones:org-get-effort-tag-as-seconds (heading)
+  "Return effort tags for HEADING converted to seconds."
+  (-sum
+   (-map #'pjones:org-parse-effort-tag
+         (-filter
+          (apply-partially #'string-match-p "^[0-9]")
+          (get-text-property 1 'tags heading)))))
+
+(defun pjones:org-sort-next-actions (a b)
+  "Return sort order for to-do items A and B."
+  (let ((ta (pjones:org-get-effort-tag-as-seconds a))
+        (tb (pjones:org-get-effort-tag-as-seconds b)))
+    (cond ((< ta tb) -1)
+          ((< tb ta) +1))))
 
 ;; General Org Settings
 (custom-set-variables

;;; Commentary:
;;
;;; Code:
(require 'evil)
(require 'evil-leader)
(require 'org)

 ;; TODO keywords and faces:
 '(org-todo-keywords
   (quote ((sequence "TODO(t)" "|" "DONE(d)")
           (sequence "NEXT(n)" "WAITING(w)" "BLOCKED(b)" "|" "DONE(d)" "CANCELLED(c)"))))

 '(org-todo-keyword-faces
