* mu4e: remove `ignore-errors' in the mu4e-proc sexp eater
This commit is contained in:
@ -49,7 +49,7 @@ the backend.")
|
|||||||
a length cookie:
|
a length cookie:
|
||||||
<`mu4e~cookie-pre'><length-in-hex><`mu4e~cookie-post'>.")
|
<`mu4e~cookie-pre'><length-in-hex><`mu4e~cookie-post'>.")
|
||||||
(defconst mu4e~cookie-matcher-rx
|
(defconst mu4e~cookie-matcher-rx
|
||||||
(concat mu4e~cookie-pre "\\([[:xdigit:]]+\\)" mu4e~cookie-post)
|
(purecopy (concat mu4e~cookie-pre "\\([[:xdigit:]]+\\)" mu4e~cookie-post))
|
||||||
"Regular expression matching the length cookie. Match 1 will be
|
"Regular expression matching the length cookie. Match 1 will be
|
||||||
the length (in hex).")
|
the length (in hex).")
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@ -98,7 +98,6 @@ the length (in hex).")
|
|||||||
t))
|
t))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defsubst mu4e~proc-eat-sexp-from-buf ()
|
(defsubst mu4e~proc-eat-sexp-from-buf ()
|
||||||
"'Eat' the next s-expression from `mu4e~proc-buf'. Note: this is a string,
|
"'Eat' the next s-expression from `mu4e~proc-buf'. Note: this is a string,
|
||||||
not an emacs-buffer. `mu4e~proc-buf gets its contents from the
|
not an emacs-buffer. `mu4e~proc-buf gets its contents from the
|
||||||
@ -109,25 +108,24 @@ none. `mu4e~proc-buf' is updated as well, with all processed sexp
|
|||||||
data removed."
|
data removed."
|
||||||
;; mu4e~cookie-matcher-rx:
|
;; mu4e~cookie-matcher-rx:
|
||||||
;; (concat mu4e~cookie-pre "\\([[:xdigit:]]+\\)]" mu4e~cookie-post)
|
;; (concat mu4e~cookie-pre "\\([[:xdigit:]]+\\)]" mu4e~cookie-post)
|
||||||
(ignore-errors ;; an error would e.g. when proc is killed in the middel
|
(let ((b (string-match mu4e~cookie-matcher-rx mu4e~proc-buf))
|
||||||
(let ((b (string-match mu4e~cookie-matcher-rx mu4e~proc-buf))
|
(sexp-len) (objcons))
|
||||||
(sexp-len) (objcons))
|
(when b
|
||||||
(when b
|
(setq sexp-len (string-to-number (match-string 1 mu4e~proc-buf) 16))
|
||||||
(setq sexp-len (string-to-number (match-string 1 mu4e~proc-buf) 16))
|
;; does mu4e~proc-buf contain the full sexp?
|
||||||
;; does mu4e~proc-buf contain the full sexp?
|
(when (>= (length mu4e~proc-buf) (+ sexp-len (match-end 0)))
|
||||||
(when (>= (length mu4e~proc-buf) (+ sexp-len (match-end 0)))
|
;; clear-up start
|
||||||
;; clear-up start
|
(setq mu4e~proc-buf (substring mu4e~proc-buf (match-end 0)))
|
||||||
(setq mu4e~proc-buf (substring mu4e~proc-buf (match-end 0)))
|
;; note: we read the input in binary mode -- here, we take the part
|
||||||
;; 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
|
||||||
;; that is the sexp, and convert that to utf-8, before we interpret
|
;; it.
|
||||||
;; it.
|
(setq objcons (read-from-string
|
||||||
(setq objcons (read-from-string
|
(decode-coding-string
|
||||||
(decode-coding-string
|
(substring mu4e~proc-buf 0 sexp-len)
|
||||||
(substring mu4e~proc-buf 0 sexp-len)
|
'utf-8 t)))
|
||||||
'utf-8 t)))
|
(when objcons
|
||||||
(when objcons
|
(setq mu4e~proc-buf (substring mu4e~proc-buf sexp-len))
|
||||||
(setq mu4e~proc-buf (substring mu4e~proc-buf sexp-len))
|
(car objcons))))))
|
||||||
(car objcons)))))))
|
|
||||||
|
|
||||||
|
|
||||||
(defsubst mu4e~proc-filter (proc str)
|
(defsubst mu4e~proc-filter (proc str)
|
||||||
|
|||||||
Reference in New Issue
Block a user