mirror of https://github.com/djcb/mu.git
* fix error handling (with errors in the proc-filter context)
This commit is contained in:
parent
d92ad056e1
commit
fd65b992d5
|
@ -65,14 +65,15 @@ the length (in hex).")
|
|||
(list (concat "--muhome=" mu4e-mu-home))))))
|
||||
(setq mu4e~proc-buf "")
|
||||
(setq mu4e~proc-process (apply 'start-process
|
||||
mu4e~proc-name mu4e~proc-name
|
||||
mu4e-mu-binary args))
|
||||
mu4e~proc-name mu4e~proc-name
|
||||
mu4e-mu-binary args))
|
||||
;; register a function for (:info ...) sexps
|
||||
(when mu4e~proc-process
|
||||
(set-process-query-on-exit-flag mu4e~proc-process nil)
|
||||
(set-process-coding-system mu4e~proc-process 'binary 'utf-8-unix)
|
||||
(set-process-filter mu4e~proc-process 'mu4e~proc-filter)
|
||||
(set-process-sentinel mu4e~proc-process 'mu4e~proc-sentinel))))
|
||||
(unless mu4e~proc-process
|
||||
(mu4e-error "Failed to start the mu4e backend"))
|
||||
(set-process-query-on-exit-flag mu4e~proc-process nil)
|
||||
(set-process-coding-system mu4e~proc-process 'binary 'utf-8-unix)
|
||||
(set-process-filter mu4e~proc-process 'mu4e~proc-filter)
|
||||
(set-process-sentinel mu4e~proc-process 'mu4e~proc-sentinel)))
|
||||
|
||||
(defun mu4e~proc-kill ()
|
||||
"Kill the mu server process."
|
||||
|
@ -275,18 +276,18 @@ terminates."
|
|||
(cond
|
||||
((eq code 9) (message nil))
|
||||
;;(message "the mu server process has been stopped"))
|
||||
(t (mu4e-message (format "mu server process received signal %d" code)))))
|
||||
(t (error (format "mu server process received signal %d" code)))))
|
||||
((eq status 'exit)
|
||||
(cond
|
||||
((eq code 0)
|
||||
(message nil)) ;; don't do anything
|
||||
((eq code 11)
|
||||
(mu4e-message "Database is locked by another process"))
|
||||
(error "Database is locked by another process"))
|
||||
((eq code 19)
|
||||
(mu4e-message "Database empty; try indexing some messages"))
|
||||
(t (mu4e-message "mu server process ended with exit code %d" code))))
|
||||
(error "Database empty; try indexing some messages"))
|
||||
(t (error "mu server process ended with exit code %d" code))))
|
||||
(t
|
||||
(mu4e-message "Something bad happened to the mu server process")))))
|
||||
(error "Something bad happened to the mu server process")))))
|
||||
|
||||
(defun mu4e~proc-send-command (frm &rest args)
|
||||
"Send as command to the mu server process; start the process if needed."
|
||||
|
|
|
@ -525,9 +525,10 @@ process."
|
|||
|
||||
(defun mu4e-error-handler (errcode errmsg)
|
||||
"Handler function for showing an error."
|
||||
;; don't use mu4e-error here; it's running in the process filter ctx
|
||||
(case errcode
|
||||
(4 (mu4e-error "No matches for this search query."))
|
||||
(t (mu4e-error "Error %d: %s" errcode errmsg))))
|
||||
(4 (error "No matches for this search query."))
|
||||
(t (error "Error %d: %s" errcode errmsg))))
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
|
@ -625,7 +626,6 @@ FUNC (if non-nil) afterwards."
|
|||
;; better to check for specific features
|
||||
(unless (>= emacs-major-version 23)
|
||||
(mu4e-error "Emacs >= 23.x is required for mu4e"))
|
||||
|
||||
;; set up the 'pong' handler func
|
||||
(lexical-let ((func func))
|
||||
(setq mu4e-pong-func
|
||||
|
|
Loading…
Reference in New Issue