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:
3
NEWS.org
3
NEWS.org
@ -17,6 +17,9 @@
|
|||||||
- Make `shr' the default renderer for rich-text emails
|
- Make `shr' the default renderer for rich-text emails
|
||||||
- Allow for resending existing messages, possibly editing them. M-x
|
- Allow for resending existing messages, possibly editing them. M-x
|
||||||
mu4e-compose-resend, or use the menu; no shortcut.
|
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
|
** 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)))
|
(user-error "%s" (apply 'mu4e-format frm args)))
|
||||||
|
|
||||||
(defun mu4e~read-char-choice (prompt choices)
|
(defun mu4e~read-char-choice (prompt choices)
|
||||||
"Compatiblity wrapper for `read-char-choice'.
|
"Read and return one of CHOICES, prompting for PROMPT.
|
||||||
That function is available which emacs-24 only."
|
Any input that is not one of CHOICES is ignored. This mu4e's
|
||||||
(let ((choice) (ok) (inhibit-quit nil))
|
version of `read-char-choice', that becomes case-insentive after
|
||||||
(while (not ok)
|
trying an exact match."
|
||||||
|
(let ((choice) (chosen) (inhibit-quit nil))
|
||||||
|
(while (not chosen)
|
||||||
(message nil);; this seems needed...
|
(message nil);; this seems needed...
|
||||||
(setq choice (read-char-exclusive prompt))
|
(setq choice (read-char-exclusive prompt))
|
||||||
(setq ok (member choice choices)))
|
(setq chosen (or (member choice choices)
|
||||||
choice))
|
(member (downcase choice) choices)
|
||||||
|
(member (upcase choice) choices))))
|
||||||
|
(car chosen)))
|
||||||
|
|
||||||
(defun mu4e-read-option (prompt options)
|
(defun mu4e-read-option (prompt options)
|
||||||
"Ask user for an option from a list on the input area.
|
"Ask user for an option from a list on the input area.
|
||||||
|
|||||||
Reference in New Issue
Block a user