* mu4e-utils: fixes for mu4e-read-option

This commit is contained in:
djcb
2012-04-15 14:23:44 +03:00
parent 6b4ced1f4f
commit 2fd793746c

View File

@ -97,14 +97,15 @@ Function returns the CHAR typed."
"[" (propertize (make-string 1 kar) 'face 'mu4e-view-link-face) "]" "[" (propertize (make-string 1 kar) 'face 'mu4e-view-link-face) "]"
descr))) options ", ")) descr))) options ", "))
(inhibit-quit nil) ;; allow C-g from read-char, not sure why this is needed (inhibit-quit nil) ;; allow C-g from read-char, not sure why this is needed
(response (okchar)
(ignore-errors (response))
(read-char (while (not okchar)
(message nil) ;; we need to clear the echo area first... why?!
(setq response
(read-char-exclusive
(concat prompt optionsstr (concat prompt optionsstr
" [" (propertize "C-g" 'face 'highlight) " to quit]"))))) " [" (propertize "C-g" 'face 'highlight) " to quit]")))
;; if the input is not one of the options, try again (setq okchar (member response optionkars)))
(unless (member response optionkars) (mu4e-read-option prompt options))
;; otherwise, return the response char
response)) response))
@ -406,18 +407,14 @@ process."
(plist-get info :cleaned-up))))) (plist-get info :cleaned-up)))))
((plist-get info :message) (message "%s" (plist-get info :message)))))) ((plist-get info :message) (message "%s" (plist-get info :message))))))
(defun mu4e-error-handler (errcode errmsg) (defun mu4e-error-handler (errcode errmsg)
"Handler function for showing an error."
(let ((errcode (plist-get err :error))
"Handler function for showing an error." "Handler function for showing an error."
(case errcode (case errcode
(4 (message "No matches for this search query.")) (4 (message "No matches for this search query."))
(t (message (format "Error %d: %s" errcode errmsg))))) (t (message (format "Error %d: %s" errcode errmsg)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;