Forráskód Böngészése

New effort-setting commands

To set the effort property without going to column view.
Carsten Dominik 15 éve
szülő
commit
6bddc14c20
7 módosított fájl, 135 hozzáadás és 20 törlés
  1. 7 0
      doc/ChangeLog
  2. 19 5
      doc/org.texi
  3. 5 5
      doc/orgcard.tex
  4. 9 0
      lisp/ChangeLog
  5. 62 8
      lisp/org-agenda.el
  6. 2 1
      lisp/org-clock.el
  7. 31 1
      lisp/org.el

+ 7 - 0
doc/ChangeLog

@@ -1,3 +1,10 @@
+2009-08-29  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* orgcard.tex: Document new effort setting commands.
+
+	* org.texi (Effort estimates): Document new effort setting
+	commands.
+
 2009-08-27  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* orgcard.tex: Document the new keys for agenda time motion.

+ 19 - 5
doc/org.texi

@@ -5528,11 +5528,25 @@ assign effort estimates to entries.  If you are also clocking your work, you
 may later want to compare the planned effort with the actual working time, a
 great way to improve planning estimates.  Effort estimates are stored in a
 special property @samp{Effort}@footnote{You may change the property being
-used with the variable @code{org-effort-property}.}.  Clearly the best way to
-work with effort estimates is through column view (@pxref{Column view}).  You
-should start by setting up discrete values for effort estimates, and a
-@code{COLUMNS} format that displays these values together with clock sums (if
-you want to clock your time).  For a specific buffer you can use
+used with the variable @code{org-effort-property}.}.  You can set the effort
+for an entry with the following commands:
+
+@table @kbd
+@kindex C-c C-x e
+@item C-c C-x e
+Set the effort estimate for the current entry.  With a numeric prefix
+argument, set it to the NTH allowed value (see below).  This command is also
+accessible from the agenda with the @kbd{e} key.
+@kindex C-c C-x C-e
+@item C-c C-x C-e
+Modify the effort estimate of the item currently being clocked.
+@end table
+
+Clearly the best way to work with effort estimates is through column view
+(@pxref{Column view}).  You should start by setting up discrete values for
+effort estimates, and a @code{COLUMNS} format that displays these values
+together with clock sums (if you want to clock your time).  For a specific
+buffer you can use
 
 @example
 #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00

+ 5 - 5
doc/orgcard.tex

@@ -549,7 +549,7 @@ after  ``{\tt :}'', and dictionary words elsewhere.
 
 \section{Properties and Column View}
 
-\key{set property}{C-c C-x p}
+\key{set property/effort}{C-c C-x p/e}
 \key{special commands in property lines}{C-c C-c}
 \key{next/previous allowed value}{S-left/right}
 \key{turn on column view}{C-c C-x C-c}
@@ -651,9 +651,9 @@ after  ``{\tt :}'', and dictionary words elsewhere.
 \key{kill item and source}{C-k}
 \key{archive the subtree (file/tag/sibling)}{\$ / a / A}
 \key{refile the subtree}{C-c C-w}
-\key{show tags of current headline}{T}
-\key{set tags for current headline/region}{:}
-\key{set / compute priority of current item}{p / P}
+\key{set/show tags of current headline}{: / T}
+\key{set effort property (prefix=nth)}{e}
+\key{set / compute priority of current item}{, / P}
 \key{raise/lower priority of current item}{S-UP/DOWN$^3$}
 \key{run an attachment command}{C-c C-a}
 \key{schedule/set deadline for this item}{C-c C-s/d}
@@ -667,7 +667,7 @@ after  ``{\tt :}'', and dictionary words elsewhere.
 
 {\bf Misc}
 
-\key{open link in current line/entry}{C-c C-o}
+\key{follow one or offer all links in current entry}{C-c C-o}
 
 {\bf Calendar commands}
 

+ 9 - 0
lisp/ChangeLog

@@ -1,7 +1,16 @@
 2009-08-29  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-clock.el (org-clock-modify-effort-estimate): Emit message
+	about new effort.
+
+	* org.el (org-set-effort): New function.
+	(org-mode-map): New key for effort setting command.
+
 	* org-agenda.el (org-agenda): Keep window setup when calling
 	agenda from within agenda window.
+	(org-agenda-mode-map): New keys for effort setting commands.
+	(org-agenda-menu): Add effort setting commands to menu.
+	(org-agenda-set-property, org-agenda-set-effort): New functions.
 
 	* org-latex.el (org-export-latex-tables): Fix
 	`org-table-last-alignment' and `org-table-last-column-widths' if

+ 62 - 8
lisp/org-agenda.el

@@ -1330,25 +1330,24 @@ The following commands are available:
 (org-defkey org-agenda-mode-map [(tab)]    'org-agenda-goto)
 (org-defkey org-agenda-mode-map "\C-m"     'org-agenda-switch-to)
 (org-defkey org-agenda-mode-map "\C-k"     'org-agenda-kill)
-(org-defkey org-agenda-mode-map "\C-c$"    'org-agenda-archive)
-(org-defkey org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive)
 (org-defkey org-agenda-mode-map "\C-c\C-w" 'org-agenda-refile)
 (org-defkey org-agenda-mode-map "m"        'org-agenda-bulk-mark)
 (org-defkey org-agenda-mode-map "u"        'org-agenda-bulk-unmark)
 (org-defkey org-agenda-mode-map "U"        'org-agenda-bulk-remove-all-marks)
 (org-defkey org-agenda-mode-map "B"        'org-agenda-bulk-action)
 (org-defkey org-agenda-mode-map "\C-c\C-x!" 'org-reload)
+(org-defkey org-agenda-mode-map "\C-c$"    'org-agenda-archive)
+(org-defkey org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive)
 (org-defkey org-agenda-mode-map "$"        'org-agenda-archive)
 (org-defkey org-agenda-mode-map "A"        'org-agenda-archive-to-archive-sibling)
 (org-defkey org-agenda-mode-map "\C-c\C-o" 'org-agenda-open-link)
 (org-defkey org-agenda-mode-map " "        'org-agenda-show)
-(org-defkey org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
 (org-defkey org-agenda-mode-map [(control shift right)] 'org-agenda-todo-nextset)
 (org-defkey org-agenda-mode-map [(control shift left)]  'org-agenda-todo-previousset)
 (org-defkey org-agenda-mode-map "\C-c\C-xb" 'org-agenda-tree-to-indirect-buffer)
-(org-defkey org-agenda-mode-map "b"        'org-agenda-tree-to-indirect-buffer)
 (org-defkey org-agenda-mode-map "o"        'delete-other-windows)
 (org-defkey org-agenda-mode-map "L"        'org-agenda-recenter)
+(org-defkey org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
 (org-defkey org-agenda-mode-map "t"        'org-agenda-todo)
 (org-defkey org-agenda-mode-map "a"        'org-agenda-toggle-archive-tag)
 (org-defkey org-agenda-mode-map ":"        'org-agenda-set-tags)
@@ -1383,7 +1382,11 @@ The following commands are available:
 (org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid)
 (org-defkey org-agenda-mode-map "r" 'org-agenda-redo)
 (org-defkey org-agenda-mode-map "g" 'org-agenda-redo)
-(org-defkey org-agenda-mode-map "e" 'org-agenda-execute)
+(org-defkey org-agenda-mode-map "e" 'org-agenda-set-effort)
+(org-defkey org-agenda-mode-map "\C-c\C-xe" 'org-agenda-set-effort)
+(org-defkey org-agenda-mode-map "\C-c\C-x\C-e"
+	    'org-clock-modify-effort-estimate)
+(org-defkey org-agenda-mode-map "\C-c\C-xp" 'org-agenda-set-property)
 (org-defkey org-agenda-mode-map "q" 'org-agenda-quit)
 (org-defkey org-agenda-mode-map "x" 'org-agenda-exit)
 (org-defkey org-agenda-mode-map "\C-x\C-w" 'org-write-agenda)
@@ -1493,11 +1496,15 @@ The following commands are available:
      ["Change Time +  min" org-agenda-date-later :active (org-agenda-check-type nil 'agenda 'timeline) :keys "C-u C-u S-right"]
      ["Change Time -  min" org-agenda-date-earlier :active (org-agenda-check-type nil 'agenda 'timeline) :keys "C-u C-u S-left"]
      ["Change Date to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)])
-    ("Clock"
+    ("Clock and Effort"
      ["Clock in" org-agenda-clock-in t]
      ["Clock out" org-agenda-clock-out t]
      ["Clock cancel" org-agenda-clock-cancel t]
-     ["Goto running clock" org-clock-goto t])
+     ["Goto running clock" org-clock-goto t]
+     "--"
+     ["Set Effort" org-agenda-set-effort t]
+     ["Change clocked effort" org-clock-modify-effort-estimate
+      (org-clock-is-active)])
     ("Priority"
      ["Set Priority" org-agenda-priority t]
      ["Increase Priority" org-agenda-priority-up t]
@@ -4404,7 +4411,7 @@ Any match of REMOVE-RE will be removed from TXT."
 		(error nil)))
 	(when effort
 	  (setq neffort (org-hh:mm-string-to-minutes effort)
-		effort (setq effort (concat "[" effort"]" )))))
+		effort (setq effort (concat "[" effort "]" )))))
 
       (when remove-re
 	(while (string-match remove-re txt)
@@ -5980,6 +5987,53 @@ the same tree node, and the headline of the tree node in the Org-mode file."
 	(org-agenda-change-all-lines newhead hdmarker)
 	(beginning-of-line 1)))))
 
+(defun org-agenda-set-property ()
+  "Set a property for the current headline."
+  (interactive)
+  (org-agenda-check-no-diary)
+  (org-agenda-show)   ;;; FIXME This is a stupid hack and should not be needed
+  (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
+		       (org-agenda-error)))
+	 (buffer (marker-buffer hdmarker))
+	 (pos (marker-position hdmarker))
+	 (inhibit-read-only t)
+	 newhead)
+    (org-with-remote-undo buffer
+      (with-current-buffer buffer
+	(widen)
+	(goto-char pos)
+	(save-excursion
+	  (org-show-context 'agenda))
+	(save-excursion
+	  (and (outline-next-heading)
+	       (org-flag-heading nil)))   ; show the next heading
+	(goto-char pos)
+	(call-interactively 'org-set-property)))))
+
+(defun org-agenda-set-effort ()
+  "Set the effort property for the current headline."
+  (interactive)
+  (org-agenda-check-no-diary)
+  (org-agenda-show)   ;;; FIXME This is a stupid hack and should not be needed
+  (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
+		       (org-agenda-error)))
+	 (buffer (marker-buffer hdmarker))
+	 (pos (marker-position hdmarker))
+	 (inhibit-read-only t)
+	 newhead)
+    (org-with-remote-undo buffer
+      (with-current-buffer buffer
+	(widen)
+	(goto-char pos)
+	(save-excursion
+	  (org-show-context 'agenda))
+	(save-excursion
+	  (and (outline-next-heading)
+	       (org-flag-heading nil)))   ; show the next heading
+	(goto-char pos)
+	(call-interactively 'org-set-effort)
+	(end-of-line 1)))))
+
 (defun org-agenda-toggle-archive-tag ()
   "Toggle the archive tag for the current entry."
   (interactive)

+ 2 - 1
lisp/org-clock.el

@@ -425,7 +425,8 @@ the mode line."
      (setq value (max 0 value)
 	   org-clock-effort (org-minutes-to-hh:mm-string value))
      (org-entry-put org-clock-marker "Effort" org-clock-effort)
-     (org-clock-update-mode-line))))
+     (org-clock-update-mode-line)
+     (message "Effort is now %s" org-clock-effort))))
 
 (defvar org-clock-notification-was-shown nil
   "Shows if we have shown notification already.")

+ 31 - 1
lisp/org.el

@@ -11673,6 +11673,35 @@ Being in this list makes sure that they are offered for completion.")
       (call-interactively 'org-compute-property-at-point))
      (t (error "No such property action %c" c)))))
 
+(defun org-set-effort (&optional value)
+  "Set the effort property of the current entry.
+With numerical prefix arg, use the nth allowed value, 0 stands for the 10th
+allowed value."
+  (interactive "P")
+  (if (equal value 0) (setq value 10))
+  (let* ((completion-ignore-case t)
+	 (prop org-effort-property)
+	 (cur (org-entry-get nil prop))
+	 (allowed (org-property-get-allowed-values nil prop 'table))
+	 (existing (mapcar 'list (org-property-values prop)))
+	 (val (cond
+	       ((stringp value) value)
+	       ((and allowed (integerp value))
+		(or (car (nth (1- value) allowed))
+		    (car (org-last allowed))))
+	       (allowed
+		(org-completing-read "Value: " allowed nil 'req-match))
+	       (t
+		(let (org-completion-use-ido org-completion-use-iswitchb)
+		  (org-completing-read
+		   (concat "Value " (if (and cur (string-match "\\S-" cur))
+					(concat "[" cur "]") "")
+			   ": ")
+		   existing nil nil "" nil cur))))))
+    (unless (equal (org-entry-get nil prop) val)
+      (org-entry-put nil prop val))
+    (message "%s is now %s" prop val)))
+
 (defun org-at-property-p ()
   "Is the cursor in a property line?"
   ;; FIXME: Does not check if we are actually in the drawer.
@@ -12104,7 +12133,7 @@ in the current file."
 		   (org-completing-read "Value: " allowed nil 'req-match)
 		 (let (org-completion-use-ido org-completion-use-iswitchb)
 		   (org-completing-read
-		    (concat "Value" (if (and cur (string-match "\\S-" cur))
+		    (concat "Value " (if (and cur (string-match "\\S-" cur))
 					(concat "[" cur "]") "")
 			    ": ")
 		    existing nil nil "" nil cur)))))
@@ -14286,6 +14315,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
 (org-defkey org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment)
 (org-defkey org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox)
 (org-defkey org-mode-map "\C-c\C-xp"    'org-set-property)
+(org-defkey org-mode-map "\C-c\C-xe"    'org-set-effort)
 (org-defkey org-mode-map "\C-c\C-xo"    'org-toggle-ordered-property)
 (org-defkey org-mode-map "\C-c\C-xi"    'org-insert-columns-dblock)
 (org-defkey org-mode-map [(control ?c) (control ?x) ?\;] 'org-timer-set-timer)