* 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
1 changed files with 17 additions and 20 deletions

View File

@ -97,16 +97,17 @@ 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)
(concat prompt optionsstr (message nil) ;; we need to clear the echo area first... why?!
" [" (propertize "C-g" 'face 'highlight) " to quit]"))))) (setq response
;; if the input is not one of the options, try again (read-char-exclusive
(unless (member response optionkars) (mu4e-read-option prompt options)) (concat prompt optionsstr
;; otherwise, return the response char " [" (propertize "C-g" 'face 'highlight) " to quit]")))
(setq okchar (member response optionkars)))
response)) response))
(defun mu4e-get-maildirs (parentdir) (defun mu4e-get-maildirs (parentdir)
"List the maildirs under PARENTDIR." ;; TODO: recursive? "List the maildirs under PARENTDIR." ;; TODO: recursive?
@ -330,10 +331,10 @@ processing takes part in the background, unless buf is non-nil."
top level if there is none." top level if there is none."
(interactive) (interactive)
(info (case major-mode (info (case major-mode
('mu4e-main-mode "(mu4e)Main view") ('mu4e-main-mode "(mu4e)Main view")
('mu4e-hdrs-mode "(mu4e)Headers view") ('mu4e-hdrs-mode "(mu4e)Headers view")
('mu4e-view-mode "(mu4e)Message view") ('mu4e-view-mode "(mu4e)Message view")
(t "mu4e")))) (t "mu4e"))))
(defun mu4e-user-agent () (defun mu4e-user-agent ()
"Return the User-Agent string for mu4e. This is either the value "Return the User-Agent string for mu4e. This is either the value
@ -406,18 +407,14 @@ process."
((plist-get info :message) (message "%s" (plist-get info :message)))))) ((plist-get info :message) (message "%s" (plist-get info :message))))))
(defun mu4e-error-handler (err) (defun mu4e-error-handler (errcode errmsg)
"Handler function for showing an error." "Handler function for showing an error."
(let ((errcode (plist-get err :error)) (case errcode
(errmsg (plist-get err :error-message)))
(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)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e-update-timer nil (defvar mu4e-update-timer nil