Browse Source

Empty matcher means prompt in agenda custom commands

When an agenda custom command has an empty string as MATCH element, so
far this would lead to a meaningless search using an empty matcher.
Now and empty (or white) string will be interpreted just like a nil
matcher, i.e. the user will be prompted for the match.
Carsten Dominik 15 years ago
parent
commit
2fcbd1d806
2 changed files with 5 additions and 1 deletions
  1. 2 0
      lisp/ChangeLog
  2. 3 1
      lisp/org-agenda.el

+ 2 - 0
lisp/ChangeLog

@@ -2,6 +2,8 @@
 
 	* org-agenda.el (org-agenda-inactive-leader): New option.
 	(org-agenda-get-timestamps): Use `org-agenda-inactive-leader'.
+	(org-tags-view): Prompt for matcher if MATCH is an empty string.
+	(org-todo-list): Prompt for matcher if ARG is an empty string.
 
 2009-12-15  Carsten Dominik  <carsten.dominik@gmail.com>
 

+ 3 - 1
lisp/org-agenda.el

@@ -3418,6 +3418,7 @@ for a keyword.  A numeric prefix directly selects the Nth keyword in
   (org-compile-prefix-format 'todo)
   (org-set-sorting-strategy 'todo)
   (org-prepare-agenda "TODO")
+  (if (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil))
   (let* ((today (time-to-days (current-time)))
 	 (date (calendar-gregorian-from-absolute today))
 	 (kwds org-todo-keywords-for-agenda)
@@ -3486,11 +3487,12 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
   (org-compile-prefix-format 'tags)
   (org-set-sorting-strategy 'tags)
   (let* ((org-tags-match-list-sublevels
-;??????	  (if todo-only t org-tags-match-list-sublevels))
 	  org-tags-match-list-sublevels)
 	 (completion-ignore-case t)
 	 rtn rtnall files file pos matcher
 	 buffer)
+    (when (and (stringp match) (not (string-match "\\S-" match)))
+      (setq match nil))
     (setq matcher (org-make-tags-matcher match)
 	  match (car matcher) matcher (cdr matcher))
     (org-prepare-agenda (concat "TAGS " match))