mirror of https://github.com/djcb/mu.git
mu4e: make mu4e~read-char-choice case-insensitive
Make mu4e~read-char-choice case insensitive if there is no exact match. Small convenience.
This commit is contained in:
parent
76dd849d06
commit
81c7786402
3
NEWS.org
3
NEWS.org
|
@ -17,6 +17,9 @@
|
|||
- Make `shr' the default renderer for rich-text emails
|
||||
- Allow for resending existing messages, possibly editing them. M-x
|
||||
mu4e-compose-resend, or use the menu; no shortcut.
|
||||
- Let `mu4e~read-char-choice' become case-insensitive if there is
|
||||
no exact match; small convenience that affects most the
|
||||
single-char option reading in mu4e.
|
||||
|
||||
** 0.9.16
|
||||
|
||||
|
|
|
@ -228,14 +228,18 @@ Does a local-exit and does not return. In emacs versions below
|
|||
(user-error "%s" (apply 'mu4e-format frm args)))
|
||||
|
||||
(defun mu4e~read-char-choice (prompt choices)
|
||||
"Compatiblity wrapper for `read-char-choice'.
|
||||
That function is available which emacs-24 only."
|
||||
(let ((choice) (ok) (inhibit-quit nil))
|
||||
(while (not ok)
|
||||
"Read and return one of CHOICES, prompting for PROMPT.
|
||||
Any input that is not one of CHOICES is ignored. This mu4e's
|
||||
version of `read-char-choice', that becomes case-insentive after
|
||||
trying an exact match."
|
||||
(let ((choice) (chosen) (inhibit-quit nil))
|
||||
(while (not chosen)
|
||||
(message nil);; this seems needed...
|
||||
(setq choice (read-char-exclusive prompt))
|
||||
(setq ok (member choice choices)))
|
||||
choice))
|
||||
(setq chosen (or (member choice choices)
|
||||
(member (downcase choice) choices)
|
||||
(member (upcase choice) choices))))
|
||||
(car chosen)))
|
||||
|
||||
(defun mu4e-read-option (prompt options)
|
||||
"Ask user for an option from a list on the input area.
|
||||
|
|
Loading…
Reference in New Issue