mirror of https://github.com/djcb/mu.git
mu/mu4e: pass muhome to server (and provide some better error info)
This commit is contained in:
parent
f50360f94e
commit
d90d2ce8ef
|
@ -213,6 +213,10 @@ struct Context {
|
||||||
GError *gerr{};
|
GError *gerr{};
|
||||||
store = mu_store_new_writable (dbpath, NULL);
|
store = mu_store_new_writable (dbpath, NULL);
|
||||||
if (!store) {
|
if (!store) {
|
||||||
|
const auto mu_init = format("mu init %s%s",
|
||||||
|
opts->muhome ? "--muhome=" : "",
|
||||||
|
opts->muhome ? opts->muhome : "");
|
||||||
|
|
||||||
if (gerr) {
|
if (gerr) {
|
||||||
if ((MuError)gerr->code == MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK)
|
if ((MuError)gerr->code == MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK)
|
||||||
print_error(MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK,
|
print_error(MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK,
|
||||||
|
@ -221,14 +225,17 @@ struct Context {
|
||||||
else
|
else
|
||||||
print_error((MuError)gerr->code,
|
print_error((MuError)gerr->code,
|
||||||
"cannot open database @ %s:%s; "
|
"cannot open database @ %s:%s; "
|
||||||
"please try 'mu init", dbpath,
|
"please try '%s", dbpath,
|
||||||
gerr->message ? gerr->message : "something went wrong");
|
gerr->message ? gerr->message : "something went wrong",
|
||||||
|
mu_init.c_str());
|
||||||
} else
|
} else
|
||||||
print_error(MU_ERROR,
|
print_error(MU_ERROR,
|
||||||
"cannot open database @ %s; pleasy try 'mu init'", dbpath);
|
"cannot open database @ %s; please try '%s'",
|
||||||
|
dbpath, mu_init.c_str());
|
||||||
|
|
||||||
throw Mu::Error (Error::Code::Store, &gerr/*consumed*/,
|
throw Mu::Error (Error::Code::Store, &gerr/*consumed*/,
|
||||||
"failed to open database @ %s; please try 'mu init'", dbpath);
|
"failed to open database @ %s; please try '%s'",
|
||||||
|
dbpath, mu_init.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
query = mu_query_new (store, &gerr);
|
query = mu_query_new (store, &gerr);
|
||||||
|
|
|
@ -252,7 +252,8 @@ Start the process if needed."
|
||||||
(unless (file-executable-p mu4e-mu-binary)
|
(unless (file-executable-p mu4e-mu-binary)
|
||||||
(mu4e-error (format "`mu4e-mu-binary' (%S) not found" mu4e-mu-binary)))
|
(mu4e-error (format "`mu4e-mu-binary' (%S) not found" mu4e-mu-binary)))
|
||||||
(let* ((process-connection-type nil) ;; use a pipe
|
(let* ((process-connection-type nil) ;; use a pipe
|
||||||
(args '("server")))
|
(args (when mu4e-mu-home `(,(format"--muhome=%s" mu4e-mu-home))))
|
||||||
|
(args (cons "server" args)))
|
||||||
(setq mu4e~proc-buf "")
|
(setq mu4e~proc-buf "")
|
||||||
(setq mu4e~proc-process (apply 'start-process
|
(setq mu4e~proc-process (apply 'start-process
|
||||||
mu4e~proc-name mu4e~proc-name
|
mu4e~proc-name mu4e~proc-name
|
||||||
|
|
Loading…
Reference in New Issue