[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
read-char-spec.el -- generalized `y-or-n-p'
From: |
Edward O'Connor |
Subject: |
read-char-spec.el -- generalized `y-or-n-p' |
Date: |
Mon, 22 Jun 2009 18:40:53 -0700 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (darwin) |
Hi,
read-char-spec.el provides a generalization of the `y-or-n-p' UI for
when you need other possible answers. Basically, `read-char-spec' is to
`read-char' as `format-spec' is to `format'. Here's how you would
re-implement `y-or-n-p' with `read-char-spec':
(defun example-y-or-n-p (prompt)
"Copy of `y-or-n-p', as an example use of `read-char-spec'.
PROMPT is as for `y-or-n-p'."
(read-char-spec prompt '((?y t "Answer in the affirmative")
(?n nil "Answer in the negative"))))
In the future, the latest version should always be accessible at this
URL:
http://edward.oconnor.cx/elisp/read-char-spec.el
Share and Enjoy!
--
Edward O'Connor
address@hidden
Ense petit placidam sub libertate quietem.
read-char-spec.el
Description: read-char-spec.el -- generalized `y-or-n-p'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- read-char-spec.el -- generalized `y-or-n-p',
Edward O'Connor <=