*** old-org.el	2009-01-04 03:01:50.000000000 -0500
--- org.el	2009-01-29 21:09:17.000000000 -0500
***************
*** 1459,1465 ****
  		   (choice
  		    :tag "Interpretation"
  		    (const :tag "Sequence (cycling hits every state)" sequence)
! 		    (const :tag "Type     (cycling directly to DONE)" type))
  		   (repeat
  		    (string :tag "Keyword"))))))
  
--- 1459,1467 ----
  		   (choice
  		    :tag "Interpretation"
  		    (const :tag "Sequence (cycling hits every state)" sequence)
! 		    (const :tag "Type     (cycling directly to DONE)" type)
! 		    (const :tag "Chosenness    (to record decisions)" 
! 		       chosenness))
  		   (repeat
  		    (string :tag "Keyword"))))))
  
***************
*** 3025,3031 ****
      (org-set-local 'org-file-properties nil)
      (org-set-local 'org-file-tags nil)
      (let ((re (org-make-options-regexp
! 	       '("CATEGORY" "SEQ_TODO" "TYP_TODO" "TODO" "COLUMNS"
  		 "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES"
  		 "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE")))
  	  (splitre "[ \t]+")
--- 3027,3033 ----
      (org-set-local 'org-file-properties nil)
      (org-set-local 'org-file-tags nil)
      (let ((re (org-make-options-regexp
! 	       '("CATEGORY" "SEQ_TODO" "TYP_TODO" "TODO" "CHOOSE_TODO" "COLUMNS"
  		 "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES"
  		 "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE")))
  	  (splitre "[ \t]+")
***************
*** 3052,3057 ****
--- 3054,3061 ----
  	      (push (cons 'sequence (org-split-string value splitre)) kwds))
  	     ((equal key "TYP_TODO")
  	      (push (cons 'type (org-split-string value splitre)) kwds))
+ 	     ((equal key "CHOOSE_TODO")
+ 	      (push (cons 'chosenness (org-split-string value splitre)) kwds))
  	     ((equal key "TAGS")
  	      (setq tags (append tags (org-split-string value splitre))))
  	     ((equal key "COLUMNS")
***************
*** 3133,3138 ****
--- 3137,3148 ----
        (setq kwds (nreverse kwds))
        (let (inter kws kw)
  	(while (setq kws (pop kwds))
+ 	  (let
+ 	     ((kws
+ 		 (or
+ 		    (run-hook-with-args-until-success
+ 		       'org-todo-setup-filter-hook kws) 
+ 		    kws)))
  	     (setq inter (pop kws) sep (member "|" kws)
  		kws0 (delete "|" (copy-sequence kws))
  		kwsa nil
***************
*** 3154,3160 ****
  				      '((:endgroup))))
  		hw (car kws1)
  		dws (if sep (org-remove-keyword-keys (cdr sep)) (last kws1))
! 		tail (list inter hw (car dws) (org-last dws)))
  	  (add-to-list 'org-todo-heads hw 'append)
  	  (push kws1 org-todo-sets)
  	  (setq org-done-keywords (append org-done-keywords dws nil))
--- 3164,3170 ----
  				 '((:endgroup))))
  		hw (car kws1)
  		dws (if sep (org-remove-keyword-keys (cdr sep)) (last kws1))
! 		tail (list inter hw (car dws) (org-last dws))))
  	  (add-to-list 'org-todo-heads hw 'append)
  	  (push kws1 org-todo-sets)
  	  (setq org-done-keywords (append org-done-keywords dws nil))
***************
*** 4934,4944 ****
        (org-back-to-heading)
        (outline-previous-heading)
        (looking-at org-todo-line-regexp))
      (if (or arg
  	    (not (match-beginning 2))
  	    (member (match-string 2) org-done-keywords))
! 	(insert (car org-todo-keywords-1) " ")
!       (insert (match-string 2) " "))
      (when org-provide-todo-statistics
        (org-update-parent-todo-statistics))))
  
--- 4944,4963 ----
        (org-back-to-heading)
        (outline-previous-heading)
        (looking-at org-todo-line-regexp))
+     (let*
+        ((new-mark-x
  	   (if (or arg
  		  (not (match-beginning 2))
  		  (member (match-string 2) org-done-keywords))
! 	      (car org-todo-keywords-1)
! 	      (match-string 2)))
! 	  (new-mark
! 	     (or
! 		(run-hook-with-args-until-success
! 		   'org-todo-get-default-hook new-mark-x nil)
! 		new-mark-x)))
!        (insert new-mark " "))
!      
      (when org-provide-todo-statistics
        (org-update-parent-todo-statistics))))
  
***************
*** 8190,8195 ****
--- 8209,8226 ----
  :from  previous state (keyword as a string), or nil
  :to    new state (keyword as a string), or nil")
  
+ (defvar org-todo-setup-filter-hook nil 
+    "Hook for functions that pre-filter todo specs.
+ 
+ Each function takes a todo spec and returns either `nil' or the spec
+ transformed into canonical form." )
+ 
+ (defvar org-todo-get-default-hook nil
+    "Hook for functions that get a default item for todo.
+ 
+ Each function takes arguments (NEW-MARK OLD-MARK) and returns either
+ `nil' or a string to be used for the todo mark." )
+ 
  (defvar org-agenda-headline-snapshot-before-repeat)
  (defun org-todo (&optional arg)
    "Change the TODO state of an item.
***************
*** 8285,8291 ****
  		     ((null member) (or head (car org-todo-keywords-1)))
  		     ((equal this final-done-word) nil) ;; -> make empty
  		     ((null tail) nil) ;; -> first entry
! 		     ((eq interpret 'sequence)
  		      (car tail))
  		     ((memq interpret '(type priority))
  		      (if (eq this-command last-command)
--- 8316,8322 ----
  		     ((null member) (or head (car org-todo-keywords-1)))
  		     ((equal this final-done-word) nil) ;; -> make empty
  		     ((null tail) nil) ;; -> first entry
! 		     ((memq interpret '(sequence chosenness))
  		      (car tail))
  		     ((memq interpret '(type priority))
  		      (if (eq this-command last-command)
***************
*** 8294,8299 ****
--- 8325,8334 ----
  			    (or done-word (car org-done-keywords))
  			  nil)))
  		     (t nil)))
+ 	     (state (or 
+ 		       (run-hook-with-args-until-success
+ 			  'org-todo-get-default-hook state last-state) 
+ 		       state))
  	     (next (if state (concat " " state " ") " "))
  	     (change-plist (list :type 'todo-state-change :from this :to state
  				 :position startpos))
