help-gnu-emacs
[Top][All Lists]
Advanced

[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" <bturnip@gmail.com> wrote in message
1140730760.877986.48650@i39g2000cwa.googlegroups.com">news:1140730760.877986.48650@i39g2000cwa.googlegroups.com...
> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]