+2000-10-18 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * 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 <okada@opaopa.org>
* elmo2.el (elmo-generic-folder-diff): Fix.
(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)))
(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))
"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))
(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)))
(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)))))