aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2012-03-10 16:36:42 +0200
committerEli Zaretskii2012-03-10 16:36:42 +0200
commitdbf6c5a160bd52f5025c45a6babbb7ca33d4bda3 (patch)
treec987d0cd9f9c35bbec5f596e0a76d70e54ba8396
parent83a96c0872b75177c023b344ce3658d1653d09d4 (diff)
downloademacs-dbf6c5a160bd52f5025c45a6babbb7ca33d4bda3.tar.gz
emacs-dbf6c5a160bd52f5025c45a6babbb7ca33d4bda3.zip
Allow ^substr, substr=, ~word in mairix searches via the form widget.
lisp/net/mairix.el (mairix-replace-invalid-chars): Rename from mairix-replace-illegal-chars; all callers changed. Don't remove ^, ~, and = characters: they are meaningful in mairix search specs. (mairix-widget-create-query): Add usage information about mairix search forms: negating words, searching for substrings, etc.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/net/mairix.el22
2 files changed, 24 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6371ad619d2..338a8668e56 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12012-03-10 Eli Zaretskii <eliz@gnu.org>
2
3 * net/mairix.el (mairix-replace-invalid-chars): Rename from
4 mairix-replace-illegal-chars; all callers changed. Don't remove
5 ^, ~, and = characters: they are meaningful in mairix search
6 specs.
7 (mairix-widget-create-query): Add usage information about mairix
8 search forms: negating words, searching for substrings, etc.
9
12012-03-10 Jae-hyeon Park <jae-hyeon.park@desy.de> (tiny change) 102012-03-10 Jae-hyeon Park <jae-hyeon.park@desy.de> (tiny change)
2 11
3 * international/fontset.el (font-encoding-alist): Add an entry for 12 * international/fontset.el (font-encoding-alist): Add an entry for
diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index 84343b7de00..360b2286b7b 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -570,10 +570,10 @@ whole threads. Function returns t if messages were found."
570 mairix-output-buffer))) 570 mairix-output-buffer)))
571 (zerop rval))) 571 (zerop rval)))
572 572
573(defun mairix-replace-illegal-chars (header) 573(defun mairix-replace-invalid-chars (header)
574 "Replace illegal characters in HEADER for mairix query." 574 "Replace invalid characters in HEADER for mairix query."
575 (when header 575 (when header
576 (while (string-match "[^-.@/,& [:alnum:]]" header) 576 (while (string-match "[^-.@/,^=~& [:alnum:]]" header)
577 (setq header (replace-match "" t t header))) 577 (setq header (replace-match "" t t header)))
578 (while (string-match "[& ]" header) 578 (while (string-match "[& ]" header)
579 (setq header (replace-match "," t t header))) 579 (setq header (replace-match "," t t header)))
@@ -620,7 +620,7 @@ See %s for details" mairix-output-buffer)))
620 (concat 620 (concat
621 (nth 1 cur) 621 (nth 1 cur)
622 ":" 622 ":"
623 (mairix-replace-illegal-chars 623 (mairix-replace-invalid-chars
624 (widget-value 624 (widget-value
625 (cadr (assoc (concat "e" (car (cddr cur))) widgets))))) 625 (cadr (assoc (concat "e" (car (cddr cur))) widgets)))))
626 query))) 626 query)))
@@ -652,9 +652,17 @@ Fill in VALUES if based on an article."
652 (kill-all-local-variables) 652 (kill-all-local-variables)
653 (erase-buffer) 653 (erase-buffer)
654 (widget-insert 654 (widget-insert
655 "Specify your query for Mairix (check boxes for activating fields):\n\n") 655 "Specify your query for Mairix using check boxes for activating fields.\n\n")
656 (widget-insert 656 (widget-insert
657 "(Whitespaces will be converted to ',' (i.e. AND). Use '/' for OR.)\n\n") 657 (concat "Use ~word to match messages "
658 (propertize "not" 'face 'italic)
659 " containing the word)\n"
660 " substring= to match words containing the substring\n"
661 " substring=N to match words containing the substring, allowing\n"
662 " up to N errors(mising/extra/different letters)\n"
663 " ^substring= to match the substring at the beginning of a word.\n"))
664 (widget-insert
665 "Whitespace will be converted to ',' (i.e. AND). Use '/' for OR.\n\n")
658 (setq mairix-widgets (mairix-widget-build-editable-fields values)) 666 (setq mairix-widgets (mairix-widget-build-editable-fields values))
659 (when (member 'flags mairix-widget-other) 667 (when (member 'flags mairix-widget-other)
660 (widget-insert "\nFlags:\n Seen: ") 668 (widget-insert "\nFlags:\n Seen: ")
@@ -935,7 +943,7 @@ Use cursor keys or C-n,C-p to select next/previous search.\n\n")
935 (lambda (field) 943 (lambda (field)
936 (list (car (cddr field)) 944 (list (car (cddr field))
937 (if (car field) 945 (if (car field)
938 (mairix-replace-illegal-chars 946 (mairix-replace-invalid-chars
939 (funcall get-mail-header (car field))) 947 (funcall get-mail-header (car field)))
940 nil)))) 948 nil))))
941 mairix-widget-fields-list))) 949 mairix-widget-fields-list)))