[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: limit input allowed by read-from-minibuffer?
|
From: |
B. T. Raven |
|
Subject: |
Re: limit input allowed by read-from-minibuffer? |
|
Date: |
Thu, 23 Feb 2006 23:30:31 GMT |
"bturnip" <address@hidden> wrote in message
news:address@hidden
> I want to prompt for a value in the minibuffer and only accept the
> input if it matches one of the choices presented in my prompt string.
> How do I do this?
>
> (defun example()
> (interactive)
> (setq read_method(read-from-minibuffer "Read Method?
> [<,>,>>,+<,+>,+>>] " nil nil nil nil "<"))
> )
>
(defun example()
(interactive)
(setq rm '("" "<" ">" ">>" "+<" "+>" "+>>"))
(while (progn
(setq read_method(read-from-minibuffer "Read Method?
[<,>,>>,+<,+>,+>>] " nil nil nil nil "<"))
(not (member read_method rm))))
)
I haven't tested this but something close to it should work. You have to
look for the null string because that's what will be bound to your
'read_method variable if you just press enter. It will then be a synonym
for "<"
Ed