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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `are-you-fine' function definition


From: Rodolfo Medina
Subject: Re: `are-you-fine' function definition
Date: Sat, 06 Sep 2008 17:27:10 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.0.50 (gnu/linux)

Rodolfo Medina wrote:

>> now I need something like this: the function says:
>>
>>  Are you fine today?
>>
>> .  If I say `y', it says: `Oh, good.'; otherwise it says: `Why don't you
>> see a doctor?'



Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> (if (equal (read-string "Are you fine today? ") "y")
>     (message "Oh, good.")
>   (message "Why don't you see a doctor?"))
>
> You might want to change the (equal ...) test to one of these:
>
> (y-or-n-p "Are you fine today? ")
>
> (yes-or-no-p "Are you fine today? ")
>
> (let ((case-fold-search t))
>   (string-match "\\`y\\(es\\)?\\'" (read-string "Are you fine today? ")))


Thanks, the `y-or-n-p' function is perfect for what I was looking for.  But
now I wish to have something like `y-or-n-p' that asks me if I want right or
left ps footer, like this:

 Right or left? (r/l)

.  If I could access the `y-or-n-p' defun, then I could try to adapt it to an
`r-or-l-p' version, but can't find it anywhere.  Please any suggestion?

Thanks
Rodolfo


reply via email to

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