Browse Source

Minor fixes than are needed to complete the previous commit

Carsten Dominik 15 years ago
parent
commit
774964adba
2 changed files with 13 additions and 5 deletions
  1. 3 0
      lisp/ChangeLog
  2. 10 5
      lisp/org-agenda.el

+ 3 - 0
lisp/ChangeLog

@@ -6,6 +6,9 @@
 	(org-agenda-search-view-force-full-words): New option.
 	(org-agenda-search-view-force-full-words): New option.
 	(org-search-view): Improve docstring, and implement a better logic
 	(org-search-view): Improve docstring, and implement a better logic
 	for Boolean and phrase searches.
 	for Boolean and phrase searches.
+	(org-agenda-last-search-view-search-was-boolean): New variable.
+	(org-agenda-manipulate-query): Consider the type of the last
+	search when modifying the search string.
 
 
 2010-01-04  Carsten Dominik  <carsten.dominik@gmail.com>
 2010-01-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
 

+ 10 - 5
lisp/org-agenda.el

@@ -3231,9 +3231,11 @@ that when \"+Ameli\" is searched as a work, it will also match \"Ameli's\"")
     (modify-syntax-entry ?` "." org-search-syntax-table))
     (modify-syntax-entry ?` "." org-search-syntax-table))
   org-search-syntax-table)
   org-search-syntax-table)
 
 
+(defvar org-agenda-last-search-view-search-was-boolean nil)
+
 ;;;###autoload
 ;;;###autoload
 (defun org-search-view (&optional todo-only string edit-at)
 (defun org-search-view (&optional todo-only string edit-at)
-  "Show all entries that contain words or regular expressions.
+  "Show all entries that contain a phrase or words or regular expressions.
 
 
 With optional prefix argument TODO-ONLY, only consider entries that are
 With optional prefix argument TODO-ONLY, only consider entries that are
 TODO entries.  The argument STRING can be used to pass a default search
 TODO entries.  The argument STRING can be used to pass a default search
@@ -3269,8 +3271,8 @@ match in the entry.
   exclamation mark, this also means to look at TODO entries only, an effect
   exclamation mark, this also means to look at TODO entries only, an effect
   that can also be achieved with a prefix argument.
   that can also be achieved with a prefix argument.
 - If (possibly after star and exclamation mark) the seatch string starts
 - If (possibly after star and exclamation mark) the seatch string starts
-  with a colon, this will mean that the snippets of the boolean search
-  must match as full words. 
+  with a colon, this will mean that the (non-regexp) snippets of the
+  Boolean search must match as full words. 
 
 
 This command searches the agenda files, and in addition the files listed
 This command searches the agenda files, and in addition the files listed
 in `org-agenda-text-search-extra-files'."
 in `org-agenda-text-search-extra-files'."
@@ -3320,6 +3322,7 @@ in `org-agenda-text-search-extra-files'."
 	    (member (string-to-char string) '(?- ?+ ?\{)))
 	    (member (string-to-char string) '(?- ?+ ?\{)))
 	(setq boolean t))
 	(setq boolean t))
     (setq words (org-split-string words))
     (setq words (org-split-string words))
+    (setq org-agenda-last-search-view-search-was-boolean boolean)
     (when boolean
     (when boolean
       (let (wds w)
       (let (wds w)
 	(while (setq w (pop words))
 	(while (setq w (pop words))
@@ -5416,8 +5419,10 @@ Negative selection means, regexp must not match for selection of an entry."
    ((eq org-agenda-type 'search)
    ((eq org-agenda-type 'search)
     (org-add-to-string
     (org-add-to-string
      'org-agenda-query-string
      'org-agenda-query-string
-     (cdr (assoc char '((?\[ . " +") (?\] . " -")
-			(?\{ . " +{}") (?\} . " -{}")))))
+     (if org-agenda-last-search-view-search-was-boolean
+	 (cdr (assoc char '((?\[ . " +") (?\] . " -")
+			    (?\{ . " +{}") (?\} . " -{}"))))
+       " "))
     (setq org-agenda-redo-command
     (setq org-agenda-redo-command
 	  (list 'org-search-view
 	  (list 'org-search-view
 		org-todo-only
 		org-todo-only