[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

search string in FRED window



I like to search for a string in a FRED buffer non-interactively,
i.e., by calling a function like 

search-string-in-fred-window <window> <string>

If the string is found in the window it should be marked and
positioned to a visible window location. Is there a nice way to do
this in MACL 1.3.2? After all, the string search dialog must be doing
this. A naive (read not working) approach is:

(defun search-string-in-fred-window (Window String)
  (ask Window
    (window-select-event-handler)
    (ed-i-search-forward)
      (dotimes (I (length String))
        (window-key-event-handler (char String I)))))


Calling this function results in:

> Error: Unbound variable: *CURRENT-EVENT* .
> While executing: DO-NEXT-I-SEARCH
> Type Command-/ to continue, Command-. to abort.
1 > 

Apparently once incremental search is started DO-NEXT-I-SEARCH is
expecting an event. This event has not really taken place as I "faked"
it by sending window-key-event-handler myself.

Well, I assume that there's a much better way to do this. Any
suggestions are welcome. In general it would be nice to have a
low-level batch facility based on individual keystrokes to implement
new commands.

  Thanks,  Alex