From e11e83e2a489991ddeadd5f33d406060bf57d808 Mon Sep 17 00:00:00 2001 From: djcb Date: Fri, 28 Sep 2012 17:11:58 +0300 Subject: [PATCH] * mu4e: mu4e-proc: capture sexp evaluation in (ignore-errors ...) --- mu4e/mu4e-proc.el | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/mu4e/mu4e-proc.el b/mu4e/mu4e-proc.el index 122e062c..1457de19 100644 --- a/mu4e/mu4e-proc.el +++ b/mu4e/mu4e-proc.el @@ -106,26 +106,27 @@ mu-servers in the following form: Function returns this sexp, or nil if there was none. `mu4e~proc-buf' is updated as well, with all processed sexp data removed." - ;; mu4e~cookie-matcher-rx: - ;; (concat mu4e~cookie-pre "\\([[:xdigit:]]+\\)]" mu4e~cookie-post) - (let ((b (string-match mu4e~cookie-matcher-rx mu4e~proc-buf)) - (sexp-len) (objcons)) - (when b - (setq sexp-len (string-to-number (match-string 1 mu4e~proc-buf) 16)) - ;; does mu4e~proc-buf contain the full sexp? - (when (>= (length mu4e~proc-buf) (+ sexp-len (match-end 0))) - ;; clear-up start - (setq mu4e~proc-buf (substring mu4e~proc-buf (match-end 0))) - ;; note: we read the input in binary mode -- here, we take the part - ;; that is the sexp, and convert that to utf-8, before we interpret - ;; it. - (setq objcons (read-from-string - (decode-coding-string - (substring mu4e~proc-buf 0 sexp-len) - 'utf-8 t))) - (when objcons - (setq mu4e~proc-buf (substring mu4e~proc-buf sexp-len)) - (car objcons)))))) + (ignore-errors ;; the server may die in the middle... + ;; mu4e~cookie-matcher-rx: + ;; (concat mu4e~cookie-pre "\\([[:xdigit:]]+\\)]" mu4e~cookie-post) + (let ((b (string-match mu4e~cookie-matcher-rx mu4e~proc-buf)) + (sexp-len) (objcons)) + (when b + (setq sexp-len (string-to-number (match-string 1 mu4e~proc-buf) 16)) + ;; does mu4e~proc-buf contain the full sexp? + (when (>= (length mu4e~proc-buf) (+ sexp-len (match-end 0))) + ;; clear-up start + (setq mu4e~proc-buf (substring mu4e~proc-buf (match-end 0))) + ;; note: we read the input in binary mode -- here, we take the part + ;; that is the sexp, and convert that to utf-8, before we interpret + ;; it. + (setq objcons (read-from-string + (decode-coding-string + (substring mu4e~proc-buf 0 sexp-len) + 'utf-8 t))) + (when objcons + (setq mu4e~proc-buf (substring mu4e~proc-buf sexp-len)) + (car objcons))))))) (defsubst mu4e~proc-filter (proc str)