diff options
| author | Eric Abrahamsen | 2015-02-04 05:45:02 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2015-02-04 05:45:02 +0000 |
| commit | 25224ab284edd16d41eb199d90c579340f29e8e4 (patch) | |
| tree | 57fc8aae4e8d611b1ed2160b0b746c49972501a9 | |
| parent | ac27180cca90fa1919ba0331e01794602901e7bc (diff) | |
| download | emacs-25224ab284edd16d41eb199d90c579340f29e8e4.tar.gz emacs-25224ab284edd16d41eb199d90c579340f29e8e4.zip | |
lisp/gnus/nnir.el: Revert "Enable non-ASCII IMAP searches"
| -rw-r--r-- | lisp/gnus/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/gnus/nnir.el | 123 |
2 files changed, 50 insertions, 77 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 76683310b3e..b4cc3412cd5 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2015-02-04 Eric Abrahamsen <eric@ericabrahamsen.net> | ||
| 2 | |||
| 3 | * nnir.el: Revert "Enable non-ASCII IMAP searches". | ||
| 4 | |||
| 1 | 2015-01-30 Glenn Morris <rgm@gnu.org> | 5 | 2015-01-30 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * gnus-registry.el (gnus-registry-max-pruned-entries) | 7 | * gnus-registry.el (gnus-registry-max-pruned-entries) |
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 6d111e89e80..08ca7c7e06b 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -284,8 +284,6 @@ is `(valuefunc member)'." | |||
| 284 | (eval-when-compile | 284 | (eval-when-compile |
| 285 | (autoload 'nnimap-buffer "nnimap") | 285 | (autoload 'nnimap-buffer "nnimap") |
| 286 | (autoload 'nnimap-command "nnimap") | 286 | (autoload 'nnimap-command "nnimap") |
| 287 | (autoload 'nnimap-capability "nnimap") | ||
| 288 | (autoload 'nnimap-wait-for-line "nnimap") | ||
| 289 | (autoload 'nnimap-change-group "nnimap") | 287 | (autoload 'nnimap-change-group "nnimap") |
| 290 | (autoload 'nnimap-make-thread-query "nnimap") | 288 | (autoload 'nnimap-make-thread-query "nnimap") |
| 291 | (autoload 'gnus-registry-action "gnus-registry") | 289 | (autoload 'gnus-registry-action "gnus-registry") |
| @@ -970,52 +968,33 @@ details on the language and supported extensions." | |||
| 970 | (catch 'found | 968 | (catch 'found |
| 971 | (mapcar | 969 | (mapcar |
| 972 | #'(lambda (group) | 970 | #'(lambda (group) |
| 973 | (let (artlist) | 971 | (let (artlist) |
| 974 | (condition-case () | 972 | (condition-case () |
| 975 | (when (nnimap-change-group | 973 | (when (nnimap-change-group |
| 976 | (gnus-group-short-name group) server) | 974 | (gnus-group-short-name group) server) |
| 977 | (with-current-buffer (nnimap-buffer) | 975 | (with-current-buffer (nnimap-buffer) |
| 978 | (message "Searching %s..." group) | 976 | (message "Searching %s..." group) |
| 979 | (let* ((arts 0) | 977 | (let ((arts 0) |
| 980 | (literal+ (nnimap-capability "LITERAL+")) | 978 | (result (nnimap-command "UID SEARCH %s" |
| 981 | (search (split-string | 979 | (if (string= criteria "") |
| 982 | (if (string= criteria "") | 980 | qstring |
| 983 | qstring | 981 | (nnir-imap-make-query |
| 984 | (nnir-imap-make-query | 982 | criteria qstring))))) |
| 985 | criteria qstring)) | 983 | (mapc |
| 986 | "\n")) | 984 | (lambda (artnum) |
| 987 | (coding (upcase | 985 | (let ((artn (string-to-number artnum))) |
| 988 | (replace-regexp-in-string | 986 | (when (> artn 0) |
| 989 | "-\\(unix\\|dos\\|mac\\)" "" | 987 | (push (vector group artn 100) |
| 990 | (symbol-name | 988 | artlist) |
| 991 | (cdr default-process-coding-system))))) | 989 | (when (assq 'shortcut query) |
| 992 | call result) | 990 | (throw 'found (list artlist))) |
| 993 | (setq call (nnimap-send-command | 991 | (setq arts (1+ arts))))) |
| 994 | "UID SEARCH CHARSET %s %s" coding (pop search))) | 992 | (and (car result) |
| 995 | (while search ; Non-ascii search terms | 993 | (cdr (assoc "SEARCH" (cdr result))))) |
| 996 | (unless literal+ | 994 | (message "Searching %s... %d matches" group arts))) |
| 997 | (nnimap-wait-for-line "^\\+\\(.*\\)\n")) | 995 | (message "Searching %s...done" group)) |
| 998 | (process-send-string (get-buffer-process (current-buffer)) (pop search)) | 996 | (quit nil)) |
| 999 | (process-send-string (get-buffer-process (current-buffer)) | 997 | (nreverse artlist))) |
| 1000 | (if (nnimap-newlinep nnimap-object) | ||
| 1001 | "\n" | ||
| 1002 | "\r\n"))) | ||
| 1003 | (setq result (nnimap-get-response call)) | ||
| 1004 | (mapc | ||
| 1005 | (lambda (artnum) | ||
| 1006 | (let ((artn (string-to-number artnum))) | ||
| 1007 | (when (> artn 0) | ||
| 1008 | (push (vector group artn 100) | ||
| 1009 | artlist) | ||
| 1010 | (when (assq 'shortcut query) | ||
| 1011 | (throw 'found (list artlist))) | ||
| 1012 | (setq arts (1+ arts))))) | ||
| 1013 | (and (car result) | ||
| 1014 | (cdr (assoc "SEARCH" (cdr result))))) | ||
| 1015 | (message "Searching %s... %d matches" group arts))) | ||
| 1016 | (message "Searching %s...done" group)) | ||
| 1017 | (quit nil)) | ||
| 1018 | (nreverse artlist))) | ||
| 1019 | groups)))))) | 998 | groups)))))) |
| 1020 | 999 | ||
| 1021 | (defun nnir-imap-make-query (criteria qstring) | 1000 | (defun nnir-imap-make-query (criteria qstring) |
| @@ -1069,30 +1048,25 @@ In future the following will be added to the language: | |||
| 1069 | (defun nnir-imap-expr-to-imap (criteria expr) | 1048 | (defun nnir-imap-expr-to-imap (criteria expr) |
| 1070 | "Convert EXPR into an IMAP search expression on CRITERIA" | 1049 | "Convert EXPR into an IMAP search expression on CRITERIA" |
| 1071 | ;; What sort of expression is this, eh? | 1050 | ;; What sort of expression is this, eh? |
| 1072 | (let ((literal+ (nnimap-capability "LITERAL+"))) | 1051 | (cond |
| 1073 | (cond | 1052 | ;; Simple string term |
| 1074 | ;; Simple string term | 1053 | ((stringp expr) |
| 1075 | ((stringp expr) | 1054 | (format "%s %S" criteria expr)) |
| 1076 | (format "%s %S" criteria expr)) | 1055 | ;; Trivial term: and |
| 1077 | ;; Trivial term: and | 1056 | ((eq expr 'and) nil) |
| 1078 | ((eq expr 'and) nil) | 1057 | ;; Composite term: or expression |
| 1079 | ;; Composite term: or expression | 1058 | ((eq (car-safe expr) 'or) |
| 1080 | ((eq (car-safe expr) 'or) | 1059 | (format "OR %s %s" |
| 1081 | (format "OR %s %s" | 1060 | (nnir-imap-expr-to-imap criteria (second expr)) |
| 1082 | (nnir-imap-expr-to-imap criteria (second expr)) | 1061 | (nnir-imap-expr-to-imap criteria (third expr)))) |
| 1083 | (nnir-imap-expr-to-imap criteria (third expr)))) | 1062 | ;; Composite term: just the fax, mam |
| 1084 | ;; Composite term: just the fax, mam | 1063 | ((eq (car-safe expr) 'not) |
| 1085 | ((eq (car-safe expr) 'not) | 1064 | (format "NOT (%s)" (nnir-imap-query-to-imap criteria (rest expr)))) |
| 1086 | (format "NOT (%s)" (nnir-imap-query-to-imap criteria (rest expr)))) | 1065 | ;; Composite term: just expand it all. |
| 1087 | ;; Composite term: non-ascii search term | 1066 | ((and (not (null expr)) (listp expr)) |
| 1088 | ((numberp (car-safe expr)) | 1067 | (format "(%s)" (nnir-imap-query-to-imap criteria expr))) |
| 1089 | (format "%s {%d%s}\n%s" criteria (car expr) | 1068 | ;; Complex value, give up for now. |
| 1090 | (if literal+ "+" "") (second expr))) | 1069 | (t (error "Unhandled input: %S" expr)))) |
| 1091 | ;; Composite term: just expand it all. | ||
| 1092 | ((and (not (null expr)) (listp expr)) | ||
| 1093 | (format "(%s)" (nnir-imap-query-to-imap criteria expr))) | ||
| 1094 | ;; Complex value, give up for now. | ||
| 1095 | (t (error "Unhandled input: %S" expr))))) | ||
| 1096 | 1070 | ||
| 1097 | 1071 | ||
| 1098 | (defun nnir-imap-parse-query (string) | 1072 | (defun nnir-imap-parse-query (string) |
| @@ -1134,11 +1108,6 @@ that the search language can then understand and use." | |||
| 1134 | ((eq term 'and) 'and) | 1108 | ((eq term 'and) 'and) |
| 1135 | ;; negated term | 1109 | ;; negated term |
| 1136 | ((eq term 'not) (list 'not (nnir-imap-next-expr))) | 1110 | ((eq term 'not) (list 'not (nnir-imap-next-expr))) |
| 1137 | ;; non-ascii search string | ||
| 1138 | ((and (stringp term) | ||
| 1139 | (not (= (string-bytes term) | ||
| 1140 | (length term)))) | ||
| 1141 | (list (string-bytes term) term)) | ||
| 1142 | ;; generic term | 1111 | ;; generic term |
| 1143 | (t term)))) | 1112 | (t term)))) |
| 1144 | 1113 | ||