Browse Source

TODO: Make in-buffer keyword setting more general

Now any line like

  #+XYZ_TODO:

will be assumed to define some kind of TODO chain.  If the handlers in
`org-todo-setup-filter-hook' do not do anything with this sequence, it
will be treated as `sequence'.
Carsten Dominik 16 years ago
parent
commit
2d795f8ae0
2 changed files with 12 additions and 5 deletions
  1. 3 0
      lisp/ChangeLog
  2. 9 5
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -3,6 +3,9 @@
 	* org.el (org-return): Implement `org-return-follows-link' in the
 	* org.el (org-return): Implement `org-return-follows-link' in the
 	function org-return.  This is more robust than using the mouse
 	function org-return.  This is more robust than using the mouse
 	map, I think.
 	map, I think.
+	(org-set-regexps-and-options): Match more general #+TODO lines.
+	(org-make-options-regexp): New optional argument EXTRA, for an
+	extra regexp.
 
 
 2009-02-07  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-02-07  Carsten Dominik  <carsten.dominik@gmail.com>
 
 

+ 9 - 5
lisp/org.el

@@ -3193,9 +3193,10 @@ means to push this value onto the list in the variable.")
     (org-set-local 'org-file-properties nil)
     (org-set-local 'org-file-properties nil)
     (org-set-local 'org-file-tags nil)
     (org-set-local 'org-file-tags nil)
     (let ((re (org-make-options-regexp
     (let ((re (org-make-options-regexp
-	       '("CATEGORY" "SEQ_TODO" "TYP_TODO" "TODO" "CHOOSE_TODO" "COLUMNS"
+	       '("CATEGORY" "TODO" "COLUMNS"
 		 "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES"
 		 "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES"
-		 "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE")))
+		 "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE")
+	       "\\(?:[a-zA-Z][0-9a-zA-Z_]*_TODO\\)"))
 	  (splitre "[ \t]+")
 	  (splitre "[ \t]+")
 	  kwds kws0 kwsa key log value cat arch tags const links hw dws
 	  kwds kws0 kwsa key log value cat arch tags const links hw dws
 	  tail sep kws1 prio props ftags drawers
 	  tail sep kws1 prio props ftags drawers
@@ -3220,8 +3221,10 @@ means to push this value onto the list in the variable.")
 	      (push (cons 'sequence (org-split-string value splitre)) kwds))
 	      (push (cons 'sequence (org-split-string value splitre)) kwds))
 	     ((equal key "TYP_TODO")
 	     ((equal key "TYP_TODO")
 	      (push (cons 'type (org-split-string value splitre)) kwds))
 	      (push (cons 'type (org-split-string value splitre)) kwds))
- 	     ((equal key "CHOOSE_TODO")
- 	      (push (cons 'choose (org-split-string value splitre)) kwds))
+ 	     ((string-match "\\`\\([a-zA-Z][0-9a-zA-Z_]*\\)_TODO\\'" key)
+	      ;; general TODO-like setup
+ 	      (push (cons (intern (downcase (match-string 1 key)))
+			  (org-split-string value splitre)) kwds))
 	     ((equal key "TAGS")
 	     ((equal key "TAGS")
 	      (setq tags (append tags (org-split-string value splitre))))
 	      (setq tags (append tags (org-split-string value splitre))))
 	     ((equal key "COLUMNS")
 	     ((equal key "COLUMNS")
@@ -15132,12 +15135,13 @@ Show the heading too, if it is currently invisible."
 	   nil))
 	   nil))
       (error nil))))
       (error nil))))
 
 
-(defun org-make-options-regexp (kwds)
+(defun org-make-options-regexp (kwds &optional extra)
   "Make a regular expression for keyword lines."
   "Make a regular expression for keyword lines."
   (concat
   (concat
    "^"
    "^"
    "#?[ \t]*\\+\\("
    "#?[ \t]*\\+\\("
    (mapconcat 'regexp-quote kwds "\\|")
    (mapconcat 'regexp-quote kwds "\\|")
+   (if extra (concat "\\|" extra))
    "\\):[ \t]*"
    "\\):[ \t]*"
    "\\(.+\\)"))
    "\\(.+\\)"))