mirror of https://github.com/djcb/mu.git
mu4e: automatically rebuild database when possible
This commit is contained in:
parent
8f24b4103a
commit
26dca831c6
|
@ -254,9 +254,10 @@ Start the process if needed."
|
|||
(mu4e-error (format "`mu4e-mu-binary' (%S) not found" mu4e-mu-binary)))
|
||||
(let* ((process-connection-type nil) ;; use a pipe
|
||||
(args '("server"))
|
||||
(args (append args (when mu4e-mu-home
|
||||
(list (concat "--muhome=" mu4e-mu-home))))))
|
||||
(args (append args (when mu4e-mu-home (list (concat "--muhome=" mu4e-mu-home)))))
|
||||
(args (append args (list (concat "--maildir=" mu4e-maildir)))))
|
||||
(setq mu4e~proc-buf "")
|
||||
(message "%S" args)
|
||||
(setq mu4e~proc-process (apply 'start-process
|
||||
mu4e~proc-name mu4e~proc-name
|
||||
mu4e-mu-binary args))
|
||||
|
@ -301,12 +302,8 @@ Start the process if needed."
|
|||
(cond
|
||||
((eq code 0)
|
||||
(message nil)) ;; don't do anything
|
||||
((eq code 11)
|
||||
(error "Database is locked by another process"))
|
||||
((eq code 15)
|
||||
(error "Database needs upgrade; try `mu index --rebuild'"))
|
||||
((eq code 19)
|
||||
(error "Database empty; try indexing some messages"))
|
||||
(error "Database is locked by another process"))
|
||||
(t (error "Mu server process ended with exit code %d" code))))
|
||||
(t
|
||||
(error "Something bad happened to the mu server process")))))
|
||||
|
|
|
@ -805,6 +805,9 @@ When successful, call FUNC (if non-nil) afterwards."
|
|||
(doccount (plist-get props :doccount)))
|
||||
(mu4e~check-requirements)
|
||||
(when func (funcall func))
|
||||
(when (zerop doccount)
|
||||
(mu4e-message "Store is empty; (re)indexing. This can take a while.");
|
||||
(mu4e-update-index))
|
||||
(when (and mu4e-update-interval (null mu4e~update-timer))
|
||||
(setq mu4e~update-timer
|
||||
(run-at-time
|
||||
|
|
Loading…
Reference in New Issue