unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* "y-or-n-p" but for other characters
@ 2007-06-15 14:37 weber
  2007-06-15 16:52 ` Pascal Bourguignon
  0 siblings, 1 reply; 3+ messages in thread
From: weber @ 2007-06-15 14:37 UTC (permalink / raw)
  To: help-gnu-emacs

Hi folks!
I'm trying to come up with a interactive function for fixing my
code...

I present three options to the user (myself), that are mapped to three
characters (a,b,c say)
Even though read-from-minibuffer solves my problem, y-or-n-p behavior
is more interesting because doesn't require an extra [ret].

Is there a way to code a y-or-n for a-or-b-or-c ?

Thanks in advance,
weber

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: "y-or-n-p" but for other characters
  2007-06-15 14:37 "y-or-n-p" but for other characters weber
@ 2007-06-15 16:52 ` Pascal Bourguignon
  2007-06-15 17:01   ` Pascal Bourguignon
  0 siblings, 1 reply; 3+ messages in thread
From: Pascal Bourguignon @ 2007-06-15 16:52 UTC (permalink / raw)
  To: help-gnu-emacs

weber <hugows@gmail.com> writes:

> Hi folks!
> I'm trying to come up with a interactive function for fixing my
> code...
>
> I present three options to the user (myself), that are mapped to three
> characters (a,b,c say)
> Even though read-from-minibuffer solves my problem, y-or-n-p behavior
> is more interesting because doesn't require an extra [ret].
>
> Is there a way to code a y-or-n for a-or-b-or-c ?

  (read-char "a, b or c? ")



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: "y-or-n-p" but for other characters
  2007-06-15 16:52 ` Pascal Bourguignon
@ 2007-06-15 17:01   ` Pascal Bourguignon
  0 siblings, 0 replies; 3+ messages in thread
From: Pascal Bourguignon @ 2007-06-15 17:01 UTC (permalink / raw)
  To: help-gnu-emacs

Pascal Bourguignon <pjb@informatimago.com> writes:

> weber <hugows@gmail.com> writes:
>
>> Hi folks!
>> I'm trying to come up with a interactive function for fixing my
>> code...
>>
>> I present three options to the user (myself), that are mapped to three
>> characters (a,b,c say)
>> Even though read-from-minibuffer solves my problem, y-or-n-p behavior
>> is more interesting because doesn't require an extra [ret].
>>
>> Is there a way to code a y-or-n for a-or-b-or-c ?
>
>   (read-char "a, b or c? ")

Well:

    (require 'cl)

    (defun a-or-b-or-c ()
       (loop for ch = (read-char "a, b or c? ")
             until (position ch "abc")
             finally (return ch)))

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-15 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-15 14:37 "y-or-n-p" but for other characters weber
2007-06-15 16:52 ` Pascal Bourguignon
2007-06-15 17:01   ` Pascal Bourguignon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).