[gnus git] branch master updated: m0-11-122-g046825b =1= * nnir.el (nnir-run-imap): Enable non-ASCII IMAP searches.
Lars <[email protected]> Tue, 27 Jan 2015 06:36:24 +0100
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 046825b09ff6e23ec7dfacd451d10985615b9793 (commit)
from 28461585b1ee1f47c6354fd831fe267b3e400cb1 (commit)
- Log -----------------------------------------------------------------
commit 046825b09ff6e23ec7dfacd451d10985615b9793
Author: Eric Abrahamsen <[email protected]>
Date: Tue Jan 27 16:35:25 2015 +1100
* nnir.el (nnir-run-imap): Enable non-ASCII IMAP searches.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fb860d6..12c0d11 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
2015-01-27 Eric Abrahamsen <[email protected]>
+ * nnir.el (nnir-run-imap): Enable non-ASCII IMAP searches.
+
* nnmairix.el ("nnmairix"): Declare nnmairix as virtual.
* gnus-bcklg.el (gnus-backlog-enter-article): No virtual groups should
diff --git a/lisp/nnir.el b/lisp/nnir.el
index 08ca7c7..dcb69aa 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -284,6 +284,8 @@ is `(valuefunc member)'."
(eval-when-compile
(autoload 'nnimap-buffer "nnimap")
(autoload 'nnimap-command "nnimap")
+ (autoload 'nnimap-capability "nnimap")
+ (autoload 'nnimap-wait-for-line "nnimap")
(autoload 'nnimap-change-group "nnimap")
(autoload 'nnimap-make-thread-query "nnimap")
(autoload 'gnus-registry-action "gnus-registry")
@@ -974,12 +976,31 @@ details on the language and supported extensions."
(gnus-group-short-name group) server)
(with-current-buffer (nnimap-buffer)
(message "Searching %s..." group)
- (let ((arts 0)
- (result (nnimap-command "UID SEARCH %s"
+ (let* ((arts 0)
+ (literal+ (nnimap-capability "LITERAL+"))
+ (search (split-string
(if (string= criteria "")
qstring
(nnir-imap-make-query
- criteria qstring)))))
+ criteria qstring))
+ "\n"))
+ (coding (upcase
+ (replace-regexp-in-string
+ "-\\(unix\\|dos\\|mac\\)" ""
+ (symbol-name
+ (cdr default-process-coding-system)))))
+ call result)
+ (setq call (nnimap-send-command
+ "UID SEARCH CHARSET %s %s" coding (pop search)))
+ (while search ; Non-ascii search terms
+ (unless literal+
+ (nnimap-wait-for-line "^\\+\\(.*\\)\n"))
+ (process-send-string (get-buffer-process (current-buffer)) (pop search))
+ (process-send-string (get-buffer-process (current-buffer))
+ (if (nnimap-newlinep nnimap-object)
+ "\n"
+ "\r\n")))
+ (setq result (nnimap-get-response call))
(mapc
(lambda (artnum)
(let ((artn (string-to-number artnum)))
@@ -1062,6 +1083,10 @@ In future the following will be added to the language:
;; Composite term: just the fax, mam
((eq (car-safe expr) 'not)
(format "NOT (%s)" (nnir-imap-query-to-imap criteria (rest expr))))
+ ;; Composite term: non-ascii search term
+ ((numberp (car-safe expr))
+ (format "%s {%d%s}\n%s" criteria (car expr)
+ (if literal+ "+" "") (second expr)))
;; Composite term: just expand it all.
((and (not (null expr)) (listp expr))
(format "(%s)" (nnir-imap-query-to-imap criteria expr)))
@@ -1108,6 +1133,11 @@ that the search language can then understand and use."
((eq term 'and) 'and)
;; negated term
((eq term 'not) (list 'not (nnir-imap-next-expr)))
+ ;; non-ascii search string
+ ((and (stringp term)
+ (not (= (string-bytes term)
+ (length term))))
+ (list (string-bytes term) term))
;; generic term
(t term))))
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 2 ++
lisp/nnir.el | 84 ++++++++++++++++++++++++++++++++++++++------------------
2 files changed, 59 insertions(+), 27 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project