[Openmcl-devel] How do I move the cursor in a window under program control?
Ron Garret
ron at flownet.com
Sat Oct 18 14:46:29 PDT 2014
Just for the record, here’s the code I ended up with:
; Make sure output is visible on macroexpand and eval-region
(defun fix-front-listener-cursor ()
(easygui::running-on-main-thread ()
(hi::handle-hemlock-event
(gui::front-view-for-buffer (gui::hemlock-buffer (GUI::TOP-LISTENER-DOCUMENT)))
#k"end")))
(defun macroexpand-expression (expander)
(fix-front-listener-cursor)
(in-lisp
(let ((expr (with-input-from-region (s (current-form-region)) (read s)))
(*standard-output* (HEMLOCK-EXT:TOP-LISTENER-OUTPUT-STREAM)))
(pprint expr)
(format t "~& ==>")
(multiple-value-bind (expansion err) (ignore-errors (funcall expander expr))
(pprint (or expansion (format nil "Error during macroexpansion: ~A" err))))
(terpri)
(ccl::print-listener-prompt t))))
(defcommand "Editor Execute Expression" (p)
"Executes the current region in the editor Lisp. Ensures the result is visible."
(declare (ignore p))
(fix-front-listener-cursor)
(let* ((region (copy-region (current-form-region)))
(form (when *echo-expression-to-listener* (region-to-string region))))
(when form (format (HEMLOCK-EXT:TOP-LISTENER-OUTPUT-STREAM) "~A~&" form))
(eval-region region)))
More information about the Openmcl-devel
mailing list