Xref: utzoo gnu.emacs.help:285 comp.emacs:9479 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!tut.cis.ohio-state.edu!AI.MIT.EDU!compass!worley From: compass!worley@AI.MIT.EDU (Dale Worley) Newsgroups: gnu.emacs.help,comp.emacs Subject: Aborting a search nicely Message-ID: <9011081628.AA23510@sn1987a.compass.com> Date: 8 Nov 90 16:28:18 GMT Sender: daemon@tut.cis.ohio-state.edu Followup-To: gnu.emacs.help Organization: GNUs Not Usenet Lines: 23 From: think!samsung!olivea!orc!inews!jsweedle@sdd.hp.com (Jonathan Sweedler) (re-search-forward "String") (some-commands-follow) If "String" does not exist in my buffer then the search-forward command bombs out. There must be a way to stop the search-forward from bombing out and to do something if the string is not found. C-h f re-search-forward RET reveals, in part: Optional third argument, if t, means if fail just return nil (no error). Since re-search-forward returns t if it succeeds, testing the return value can be used to determine if the search succeeded. Dale Worley Compass, Inc. worley@compass.com -- Give yourself over to absolute pleasure Swim the warm waters of sins of the flesh Erotic madness beyond any measure And sensual daydreams to treasure... forever. -- Rocky Horror Picture Show