From 139b3943bb0331957c56d832e7f5168d7b7ac92f Mon Sep 17 00:00:00 2001 From: teranisi Date: Wed, 18 Oct 2000 00:49:26 +0000 Subject: [PATCH] * elmo-filter.el (elmo-filter-folder-diff): Use target folder's diff only when filter is 'last'. * elmo-util.el (elmo-condition-atom-regexp): New constant. (elmo-condition-parse-search-value): Use it. (elmo-read-search-condition-internal): Quote value only when it is not an atom. --- elmo/ChangeLog | 10 ++++++++++ elmo/elmo-filter.el | 2 +- elmo/elmo-util.el | 32 +++++++++++++++++--------------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 7bf1705..2a20d2a 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,13 @@ +2000-10-18 Yuuichi Teranishi + + * elmo-filter.el (elmo-filter-folder-diff): Use target folder's diff + Only when filter is 'last'. + + * elmo-util.el (elmo-condition-atom-regexp): New constant. + (elmo-condition-parse-search-value): Use it. + (elmo-read-search-condition-internal): Quote value only when + it is not an atom. + 2000-10-18 Kenichi OKADA * elmo2.el (elmo-generic-folder-diff): Fix. diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 31b5300..de8c7e6 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -83,7 +83,7 @@ (defun elmo-filter-folder-diff (spec folder &optional number-list) (if (or (elmo-multi-p folder) (not (and (vectorp (nth 1 spec)) - (string-match "^first$\\|^last$" + (string-match "^last$" (elmo-filter-key (nth 1 spec)))))) (cons nil (cdr (elmo-folder-diff (nth 2 spec)))) (elmo-generic-folder-diff spec folder number-list))) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 99e1b97..bc76b31 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -482,6 +482,9 @@ File content is encoded with MIME-CHARSET." (error "%s is not supported folder type" folder)))) ;;; Search Condition + +(defconst elmo-condition-atom-regexp "[^/ \")|&]*") + (defun elmo-read-search-condition (default) "Read search condition string interactively" (elmo-read-search-condition-internal "Search by" default)) @@ -497,7 +500,8 @@ File content is encoded with MIME-CHARSET." "Since" "Before" "ToCc" "!From" "!Subject" "!To" "!Cc" "!Body" "!Since" "!Before" "!ToCc") - elmo-msgdb-extra-fields))))) + elmo-msgdb-extra-fields)))) + value) (setq field (if (string= field "") (setq field default) field)) @@ -511,19 +515,18 @@ File content is encoded with MIME-CHARSET." (concat field "(2) Search by") default) ")")) ((string-match "Since\\|Before" field) - (concat - (downcase field) ":" - (completing-read (format "Value for '%s': " field) - (mapcar (function - (lambda (x) - (list (format "%s" (car x))))) - elmo-date-descriptions)))) + (concat (downcase field) ":" + (completing-read (format "Value for '%s': " field) + (mapcar (function + (lambda (x) + (list (format "%s" (car x))))) + elmo-date-descriptions)))) (t - (concat - (downcase field) ":" - (prin1-to-string - (read-from-minibuffer - (format "Value for '%s': " field)))))))) + (setq value (read-from-minibuffer (format "Value for '%s': " field))) + (unless (string-match (concat "^" elmo-condition-atom-regexp "$") + value) + (setq value (prin1-to-string value))) + (concat (downcase field) ":" value))))) (defsubst elmo-condition-parse-error () (error "Syntax error in '%s'" (buffer-string))) @@ -613,8 +616,7 @@ Return value is a cons cell of (STRUCTURE . REST)" (looking-at "[0-9]+ *daysago") (looking-at "[0-9]+-[A-Za-z]+-[0-9]+") (looking-at "[0-9]+") - (looking-at "[^/ \")|&]*") ; atom* (except quoted specials). - ) + (looking-at elmo-condition-atom-regexp)) (prog1 (elmo-match-buffer 0) (goto-char (match-end 0)))) (t (error "Syntax error '%s'" (buffer-string))))) -- 1.7.10.4