home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / sp / part02 / sp.ml < prev   
Encoding:
Text File  |  1987-02-19  |  1.6 KB  |  70 lines

  1. ; Written by Donald Acton and Barry Brachman with help from Marc Majka
  2. ;  March 11/85
  3. ;
  4. ; Dept. of Computer Science
  5. ; University of British Columbia
  6.  
  7. (defun 
  8.     (sp spword
  9.       (setq spword (get-tty-string "Word: " ))
  10.       (do-sp spword)
  11.     )
  12. )
  13.  
  14. (defun                        ; bjb
  15.     (sp-from-buffer spword
  16.     (setq spword (get-next-word))
  17.     (message (concat "Word: " spword))
  18.     (sit-for 0)
  19.     (do-sp spword)
  20.     )
  21. )
  22.  
  23. (defun
  24.     (do-sp curr found tmp
  25.       (setq curr (current-buffer-name))
  26.       (pop-to-buffer "sp")
  27.       (setq needs-checkpointing 0)
  28.       (erase-buffer)
  29.       (set-mark)
  30.       (filter-region (concat "sp " spword))
  31.       (beginning-of-file)
  32.       (setq found " *not found*")
  33.       (setq tmp case-fold-search)
  34.       (setq case-fold-search 1)
  35.       (error-occurred (re-search-forward (concat "\. " spword "$"))
  36.                        (beginning-of-line)
  37.                        (line-to-top-of-window)
  38.                        (setq found " *found*"))
  39.       (setq case-fold-search tmp)
  40.       (setq mode-line-format " %b - %m      %p")
  41.       (setq mode-string (concat spword found))
  42.       (pop-to-buffer curr)
  43.       (novalue)))
  44.  
  45. ;
  46. ; Return the word the cursor is pointing at
  47. ; or the word immediately to the left of the
  48. ; cursor if it is between words
  49. ;
  50. ; April 15/85 - bjb
  51. ;
  52. (defun
  53.     (get-next-word original-dot rb spword
  54.     (save-excursion
  55.         (setq original-dot (dot))
  56.         (backward-word) (forward-word) (setq rb (dot))
  57.         (if (> original-dot rb)
  58.         (progn (forward-word) (backward-word))
  59.         (backward-word))
  60.         (set-mark)
  61.         (forward-word)
  62.         (setq spword (region-to-string))
  63.     )
  64.     spword
  65.    )
  66.  
  67.