From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: How to structure looking-at with error conditions Date: Wed, 24 Nov 2010 08:33:24 -0500 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1291897013 27109 80.91.229.12 (9 Dec 2010 12:16:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 12:16:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 13:16:49 2010 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.69) (envelope-from ) id 1PQfQT-0008AW-MC for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 13:16:45 +0100 Original-Received: from localhost ([127.0.0.1]:41571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQfQR-0004zO-RZ for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 07:16:44 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Injection-Info: barmar.motzarella.org; posting-host="+bxBiZT/p0ZLLuDb5H+JCw"; logging-data="14700"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nlDG3zeSFq88ndCGD9fad" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:kZWG2E3Xa74gs2IzVLI+pSDaT0s= Original-Xref: usenet.stanford.edu gnu.emacs.help:182606 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:77019 Archived-At: In article , Fren Zeee wrote: > hello emacs users > > generally, i use looking-at as follows > > (when (looking-at "desired_pattern") > ( do_this_and_that > > (do some more things) > > (when (looking-at "anther_ desired_pattern") > ( do_this_and_that) > ) > > ) > > whats your expert advice on how to modify if the cursor is not at the > desired pattern in either case so that an error message is reported ? > > should I wrap the looking-at in cond or can I add some kind of default > ie else like functioning clause to when ? > > Franz Xe Use the more general cond: (cond ((looking-at "pattern1") (do-first-stuff)) ((looking-at "pattern2") (do-other-stuff)) (t (error ...))) -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***