From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rodolfo Medina Newsgroups: gmane.emacs.help Subject: `y-or-n-p' function definition (was: `are-you-fine' function definition) Date: Sat, 06 Sep 2008 17:32:38 +0100 Organization: SunSITE.dk - Supporting Open source Message-ID: <87tzctmdzt.fsf_-_@gmail.com> References: <87ej42m64o.fsf@gmail.com> <87ej412cpw.fsf@gmail.com> <1220481354.252639@arno.fh-trier.de> <87zlmnzuwm.fsf@gmail.com> <878wu5nstd.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1220715794 3620 80.91.229.12 (6 Sep 2008 15:43:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Sep 2008 15:43:14 +0000 (UTC) Cc: kevin.d.rodgers@gmail.com To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 06 17:44:10 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KbzxJ-0003dx-JQ for geh-help-gnu-emacs@m.gmane.org; Sat, 06 Sep 2008 17:44:09 +0200 Original-Received: from localhost ([127.0.0.1]:58126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KbzwK-00053w-1j for geh-help-gnu-emacs@m.gmane.org; Sat, 06 Sep 2008 11:43:08 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!news.banetele.no!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:4u+gvR69MFERajxLdzEafeDCQb4= Original-Lines: 38 Original-NNTP-Posting-Host: 151.80.145.42 Original-X-Trace: news.sunsite.dk DXC=g\QVQ^kdaGaJfJcgG; Q1FaYSB=nbEKnkkebg1>^?UCAj:AocXk=\=_dT7bXfBO; G:eKAib\KDO`hbm=c5DAkLCDlbnM1Ve3KCOeSmD1NRFNVKe Original-X-Complaints-To: staff@sunsite.dk Original-Xref: news.stanford.edu gnu.emacs.help:161977 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:57315 Archived-At: 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 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