* add mu4e~read-char-choice, a compatibility wrapper for read-char-choice,
which is not available on emacs 23
This commit is contained in:
@ -31,7 +31,6 @@
|
|||||||
(require 'doc-view)
|
(require 'doc-view)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defcustom mu4e-html2text-command nil
|
(defcustom mu4e-html2text-command nil
|
||||||
"Shell command that converts HTML from stdin into plain text on
|
"Shell command that converts HTML from stdin into plain text on
|
||||||
stdout. If this is not defined, the emacs `html2text' tool will be
|
stdout. If this is not defined, the emacs `html2text' tool will be
|
||||||
@ -89,6 +88,17 @@ dir already existed, or has been created, nil otherwise."
|
|||||||
(string-to-char (nth 0 option))))))
|
(string-to-char (nth 0 option))))))
|
||||||
options))
|
options))
|
||||||
|
|
||||||
|
(defun mu4e~read-char-choice (prompt choices)
|
||||||
|
"Compatiblity wrapper for `read-char-choice', which is emacs-24
|
||||||
|
only."
|
||||||
|
(if (fboundp 'read-char-choice)
|
||||||
|
(read-char-choice prompt choices)
|
||||||
|
(let ((choice) (ok))
|
||||||
|
(while (not ok)
|
||||||
|
(message nil);; this seems needed...
|
||||||
|
(setq choice (read-char prompt))
|
||||||
|
(setq ok (member choice choices)))
|
||||||
|
choice)))
|
||||||
|
|
||||||
(defun mu4e-read-option (prompt options)
|
(defun mu4e-read-option (prompt options)
|
||||||
"Ask user for an option from a list on the input area. PROMPT
|
"Ask user for an option from a list on the input area. PROMPT
|
||||||
@ -130,7 +140,7 @@ User now will be presented with a list:
|
|||||||
'face 'mu4e-highlight-face) "]"
|
'face 'mu4e-highlight-face) "]"
|
||||||
descr))) options ", "))
|
descr))) options ", "))
|
||||||
(response
|
(response
|
||||||
(read-char-choice
|
(mu4e~read-char-choice
|
||||||
(concat prompt optionsstr
|
(concat prompt optionsstr
|
||||||
" [" (propertize "C-g" 'face 'mu4e-highlight-face) " to quit]")
|
" [" (propertize "C-g" 'face 'mu4e-highlight-face) " to quit]")
|
||||||
(map 'list (lambda(elm) (nth 1 elm)) options))) ;; the allowable chars
|
(map 'list (lambda(elm) (nth 1 elm)) options))) ;; the allowable chars
|
||||||
|
|||||||
Reference in New Issue
Block a user