home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / emacs / help / 4872 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.4 KB  |  50 lines

  1. Newsgroups: gnu.emacs.help
  2. Path: sparky!uunet!wupost!uwm.edu!rpi!psinntp!psinntp!snoopy!short
  3. From: short@asf.com (Lee Short)
  4. Subject: search behavior in elisp: catching a failed search
  5. Message-ID: <1992Nov18.163118.1183@asf.com>
  6. Sender: short@asf.com (Lee Short)
  7. Organization: ASF
  8. Date: Wed, 18 Nov 1992 16:31:18 GMT
  9. Lines: 39
  10.  
  11.  
  12. I'm trying to write some Elisp code that searches through a mail
  13. message for a string, and performs different actions based on whether
  14. or not the string is found.  My code looks like this:
  15.  
  16. (defun my-string-find  (string-arg)
  17.    (set-mark-command nil)
  18.    (beginning-of-buffer)
  19.    (if  (word-search-forward string-arg)
  20.        (progn
  21.           (set-mark-command t)
  22.           t
  23.        )
  24.        (progn
  25.           (set-mark-command t)
  26.           nil
  27.        )
  28.    )
  29. )
  30.  
  31.  
  32. But when I execute the line
  33.  
  34.    (if  (word-search-forward string-arg)
  35.  
  36. then my program is jumped out of.  I can't seem to find the source for
  37. word-search-forward in our source directory.  Is there a
  38. catch-and-throw signal I could catch?  Is there another function to do
  39. the search?  Is there a better way to do this in the first place?
  40.  
  41.  
  42. thanks in advance,
  43. Lee
  44.  
  45. -- 
  46. short@asf.com              The mystery of government is not how Washington
  47. Lee Short                  works, but how to make it stop.  -- P.J. O'Rourke
  48. Software Janitor        I speak for none of the many steps in the food chain
  49. Hughes Training, Inc.         between myself and General Motors corporation.
  50.