From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Spiers Subject: key bindings for quickly setting effort estimates Date: Mon, 2 Nov 2009 13:52:30 +0000 Message-ID: <20091102135230.GD25581@atlantic.linksys.moosehall> Reply-To: Adam Spiers Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N4xKo-00074U-Dp for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 08:52:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N4xKk-00072U-Sa for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 08:52:38 -0500 Received: from [199.232.76.173] (port=51339 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4xKk-00072P-Ou for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 08:52:34 -0500 Received: from arctic.adamspiers.org ([212.13.194.176]:37623) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N4xKk-00050j-BM for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 08:52:34 -0500 Received: from localhost (dsl-217-155-199-114.zen.co.uk [217.155.199.114]) by arctic.adamspiers.org (Postfix) with ESMTP id CC9CE2401B for ; Mon, 2 Nov 2009 13:52:32 +0000 (UTC) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode mailing list 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