misc-emode.sl 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. %
  2. % MISC-EMODE.SL - Miscellaneous EMODE routines
  3. %
  4. % Author: William F. Galway
  5. % Symbolic Computation Group
  6. % Computer Science Dept.
  7. % University of Utah
  8. % Date: 29 July 1982
  9. % Copyright (c) 1982 University of Utah
  10. %
  11. % Get a "command" (lisp expression) and "execute" (evaluate) it.
  12. % This routine is meant to be bound to the M-X key.
  13. (de execute_command ()
  14. (let ((old-channels (save-important-channels)))
  15. (SelectEmodeChannels)
  16. % Do we need some sort of ErrorSet here?
  17. (eval
  18. (read_from_string
  19. (prompt_for_string "M-X " NIL)))
  20. (restore-important-channels old-channels)))
  21. % Insert the next character "typed".
  22. (de InsertNextCharacter ()
  23. (InsertCharacter (GetNextCommandCharacter)))
  24. % Display a list of all the buffers known to EMODE.
  25. % This needs to be redone to fit better with current window/virtual screen
  26. % package.
  27. (de PrintBufferNames ()
  28. (let ((old-channels (save-important-channels)))
  29. % Make sure that output goes to "EMODE output" channel.
  30. (SelectEmodeChannels)
  31. (for (in buffer-name BufferNames)
  32. (do
  33. % car gives name of (name . environment) pair.
  34. (prin2t (car buffer-name))))
  35. (restore-important-channels old-channels)))
  36. % Return a list of the current "important" channel bindings.
  37. (de save-important-channels ()
  38. (list STDIN* STDOUT* ErrOut*))
  39. % "Restore" the channels saved by save-important-channels.
  40. (de restore-important-channels (saved-channels)
  41. (progn
  42. (setf STDIN* (car saved-channels))
  43. (setf STDOUT* (cadr saved-channels))
  44. (setf ErrOut* (caddr saved-channels))
  45. (RDS STDIN*)
  46. (WRS STDOUT*)))