read-char-spec.el -- generalized `y-or-n-p'

View: New views
1 Messages — Rating Filter:   Alert me  

read-char-spec.el -- generalized `y-or-n-p'

by Edward O'Connor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
hober0@...

Ense petit placidam sub libertate quietem.





_______________________________________________
gnu-emacs-sources mailing list
gnu-emacs-sources@...
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources

read-char-spec.el (4K) Download Attachment