* implement the :erase message from the backend to properly clean up the
header buffer When we're doing a search while the results of a previous search are still coming in from the backend, this way we can tell the frontend that this is the right time to clear the buffer (previously, sometimes the results would be mixed).
This commit is contained in:
@ -62,6 +62,11 @@ server process; the function is passed a msg plist as argument. See
|
||||
after the headers have returns, to report on the number of
|
||||
matches. See `mu4e-proc-filter' for the format.")
|
||||
|
||||
(defvar mu4e-proc-erase-func 'mu4e-default-handler
|
||||
"*internal* A function called for when we received an :erase sexp
|
||||
after the headers have returns, to clear the current headers
|
||||
buffer. See `mu4e-proc-filter' for the format.")
|
||||
|
||||
(defvar mu4e-proc-compose-func 'mu4e-default-handler
|
||||
"*internal* A function called for each message returned from the
|
||||
server process that is used as basis for composing a new
|
||||
@ -256,10 +261,14 @@ updated as well, with all processed sexp data removed."
|
||||
((plist-get sexp :found)
|
||||
(funcall mu4e-proc-found-func (plist-get sexp :found)))
|
||||
|
||||
;; viewin a specific message
|
||||
;; viewing a specific message
|
||||
((plist-get sexp :view)
|
||||
(funcall mu4e-proc-view-func (plist-get sexp :view)))
|
||||
|
||||
;; receive an erase message
|
||||
((plist-get sexp :erase)
|
||||
(funcall mu4e-proc-erase-func))
|
||||
|
||||
;; receive a pong message
|
||||
((plist-get sexp :pong)
|
||||
(funcall mu4e-proc-pong-func
|
||||
@ -433,7 +442,7 @@ be delivered to the function registered as `mu4e-proc-message-func'."
|
||||
The result will be delivered to the function registered as
|
||||
`mu4e-proc-compose-func'."
|
||||
(unless (member compose-type '(forward reply edit))
|
||||
(error "Unsupported compose-type"))
|
||||
(error "Unsupported compose-type %S" compose-type))
|
||||
(mu4e-proc-send-command "compose %s %d" (symbol-name compose-type) docid))
|
||||
|
||||
|
||||
|
||||
@ -51,6 +51,12 @@ Using the \fBfind\fR command we can search for messages.
|
||||
.nf
|
||||
-> find "<query>" <maxnum>
|
||||
.fi
|
||||
First, this will return an 'erase'-sexp, to clear the buffer from possible
|
||||
results from a previous query.
|
||||
.nf
|
||||
<- (:erase t)
|
||||
.fi
|
||||
|
||||
This will return a series of 0 up to <maxnum> s-expression corresponding to each
|
||||
message found (with a negative number for <maxnum> meaning 'unlimited'). The
|
||||
information for each message does not contain the message body; the \fBview\fR
|
||||
|
||||
@ -376,6 +376,12 @@ cmd_find (MuStore *store, MuQuery *query, GSList *args, GError **err)
|
||||
return server_error (err, MU_ERROR_INTERNAL,
|
||||
"couldn't get iterator");
|
||||
|
||||
/* before sending new results, send an 'erase' message, so the
|
||||
* frontend knows it should erase the headers buffer. this
|
||||
* will ensure that the output of two finds quickly will not
|
||||
* be mixed. */
|
||||
send_expr ("(:erase t)");
|
||||
|
||||
/* return results + the number of results found */
|
||||
send_expr ("(:found %u)\n", output_found_sexps (iter, maxnum));
|
||||
mu_msg_iter_destroy (iter);
|
||||
|
||||
Reference in New Issue
Block a user