home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmsmp.zip / GLOBFIND.E < prev    next >
Text File  |  1992-08-26  |  2KB  |  49 lines

  1. /* Ctrl-G = Global-find key.    Standard E3 lets you press Ctrl-F to  */
  2. /* repeat-find in the current file.  Now Ctrl-G does the repeat-find  */
  3. /* on ALL the files in the ring.  Very useful when I'm editing several*/
  4. /* small program modules and I want to find where something's defined.*/
  5. /*                                                                    */
  6. /* Installation:  Include this in your MYKEYS.E.  There's nothing     */
  7. /* special about the choice of key Ctrl-G, change the DEF if you like.*/
  8.  
  9. DEF c_g=
  10.    /* Remember our current file so we don't search forever.  */
  11.    getfileid StartFileID
  12.    /* First repeat-find in current file in case we don't have to move.*/
  13.  
  14.    repeat_find
  15.  
  16.    if rc=0 then stop endif
  17.    fileid=StartFileID
  18.    loop
  19.       nextfile
  20.       getfileid fileid
  21.       activatefile fileid
  22.  
  23.       /* Include this refresh if you like to see each file as it's */
  24.       /* searched.  Causes too much screen flashing for my taste,  */
  25. ;;       refresh
  26.  
  27.       /* Start from top of file, save current posn in case no match. */
  28.       call psave_pos(save_pos)
  29.       top ; .col=1
  30.       repeat_find
  31.       if rc=0 then
  32.          if fileid=StartFileID then
  33.             sayerror "String not found anywhere else"
  34.          else
  35.             sayerror 0
  36.          endif
  37.          leave
  38.       else
  39.          /* no match in file - restore file location */
  40.          call prestore_pos(save_pos)
  41.       endif
  42.       if fileid=StartFileID then
  43.          sayerror "String not found anywhere at all!"
  44.          leave
  45.       endif
  46.    endloop
  47.    activatefile fileid
  48.  
  49.