diff --git a/emacs/mu4e-proc.el b/emacs/mu4e-proc.el index 452add99..43f09258 100644 --- a/emacs/mu4e-proc.el +++ b/emacs/mu4e-proc.el @@ -291,6 +291,9 @@ updated as well, with all processed sexp data removed." (setq sexp (mu4e-proc-eat-sexp-from-buf))))) +;; error codes are defined in src/mu-util.h +;;(defconst mu4e-xapian-empty 19 "Error code: xapian is empty/non-existent") + (defun mu4e-proc-sentinel (proc msg) "Function that will be called when the mu-server process terminates." @@ -310,10 +313,10 @@ terminates." ((eq code 11) (message "Database is locked by another process")) ((eq code 19) - (message "Database is empty; try indexing some messages")) + (message "Database is empty or non-existent; try indexing some messages")) (t (message (format "mu server process ended with exit code %d" code))))) (t - (message "something bad happened to the mu server process"))))) + (message "Something bad happened to the mu server process"))))) (defconst mu4e-proc-log-buffer-name "*mu4e-log*" diff --git a/src/mu-cmd-server.c b/src/mu-cmd-server.c index 93c76426..891ebbda 100644 --- a/src/mu-cmd-server.c +++ b/src/mu-cmd-server.c @@ -368,13 +368,15 @@ cmd_find (MuStore *store, MuQuery *query, GSList *args, GError **err) * ones; it seems we cannot get a sorted list of a subset of * the result --> needs investigation, this is a * work-around */ - if (!(iter = mu_query_run (query, (const char*)args->data, TRUE, - MU_MSG_FIELD_ID_DATE, TRUE, -1, err))) + iter = mu_query_run (query, (const char*)args->data, TRUE, + MU_MSG_FIELD_ID_DATE, TRUE, -1, err); + if (!iter) + return server_error (err, MU_ERROR_INTERNAL, + "couldn't get iterator"); /* if (!(iter = mu_query_run (query, (const char*)args->data, TRUE, */ /* MU_MSG_FIELD_ID_DATE, TRUE, maxnum, err))) */ - return server_error (err, MU_ERROR_INTERNAL, - "couldn't get iterator"); + /* return results + the number of results found */ send_expr ("(:found %u)\n", output_found_sexps (iter, maxnum));