emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] key bindings for quickly setting effort estimates


From: Adam Spiers
Subject: [Orgmode] key bindings for quickly setting effort estimates
Date: Mon, 2 Nov 2009 13:52:30 +0000
User-agent: Mutt/1.5.20 (2009-08-17)

I found myself needing a quick way of setting effort estimates outside
column view, and came up with the following:

;; Zero effort is last (10th) element of global Effort_ALL property
;; so that we get zero effort when pressing '0' in the Effort column
;; in Column view, since this invokes `org-set-effort' with arg 0,
;; which stands for the 10th allowed value.
(let ((effort-values
       (org-property-get-allowed-values nil org-effort-property)))
  (dotimes (effort-index 10)
    (let* ((effort (nth effort-index effort-values))
           (key-suffix (number-to-string
                 (if (= effort-index 9) 0 (1+ effort-index))))
           (fn-name (concat "org-set-effort-"
                            (number-to-string effort-index)))
           (fn (intern fn-name)))
      ;; (message "Binding M-o %s to %s which sets effort to %s"
      ;;          key-suffix fn-name effort)
      (fset fn `(lambda ()
                  ,(format "Sets effort to %s." effort)
                  (interactive)
                  (org-set-effort ,(1+ effort-index))))
      (global-set-key (concat "\eo" key-suffix) fn))))

This assumes that Effort_ALL has 9 non-zero effort values, which in my
case is conveniently true:

("0:10" "0:20" "0:30" "1:00" "2:00" "3:00" "4:00" "8:00" "16:00" "0")

Hope this is of interest.

Adam




reply via email to

[Prev in Thread] Current Thread [Next in Thread]