To solve a problem with the Gnus' IMAP search in Exchange folders with Emacs 28.2, I have the modified piece of code from gnus-search.el
below. However, if I add this to my init.el
on starting Emacs I get the error that gnus-search-imap
is undefined. On the other hand, if I comment out the code, restart Emacs, start Gnus, try searching in an Exchange folder (which without the modified code always returns no result) and then evaluate the modified code, I get no error.
So can I put the code in my init.el
somehow or do I just have to patch gnus-search.el
? If the later, why is this the case?
(cl-defmethod gnus-search-imap-search-command ((engine gnus-search-imap)
(query string))
"Create the IMAP search command for QUERY.
Currently takes into account support for the LITERAL+ capability.
Other capabilities could be tested here."
(with-slots (literal-plus) engine
(when (and literal-plus
(string-match-p "\n" query))
(setq query (split-string query "\n")))
(cond
((consp query)
;; We're not really streaming, just need to prevent
;; `nnimap-send-command' from waiting for a response.
(let* ((nnimap-streaming t)
(call
(nnimap-send-command
"UID SEARCH CHARSET UTF-8 %s"
(pop query))))
(dolist (l query)
(process-send-string (get-buffer-process (current-buffer)) l)
(process-send-string (get-buffer-process (current-buffer))
(if (nnimap-newlinep nnimap-object)
"\n"
"\r\n")))
(nnimap-get-response call)))
(t (nnimap-command "UID SEARCH %s" query)))))