浏览代码

Minor fixes than are needed to complete the previous commit

Carsten Dominik 15 年之前
父节点
当前提交
774964adba
共有 2 个文件被更改,包括 13 次插入5 次删除
  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-search-view): Improve docstring, and implement a better logic
 	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>
 

+ 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))
   org-search-syntax-table)
 
+(defvar org-agenda-last-search-view-search-was-boolean nil)
+
 ;;;###autoload
 (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
 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
   that can also be achieved with a prefix argument.
 - 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
 in `org-agenda-text-search-extra-files'."
@@ -3320,6 +3322,7 @@ in `org-agenda-text-search-extra-files'."
 	    (member (string-to-char string) '(?- ?+ ?\{)))
 	(setq boolean t))
     (setq words (org-split-string words))
+    (setq org-agenda-last-search-view-search-was-boolean boolean)
     (when boolean
       (let (wds w)
 	(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)
     (org-add-to-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
 	  (list 'org-search-view
 		org-todo-only