Groovy-Emacs-Modes / groovy-emacs-modes

A groovy major mode, grails minor mode, and a groovy inferior mode.
84 stars 39 forks source link

Add "groovy-send-string" #5

Closed m0smith closed 9 years ago

m0smith commented 9 years ago

It would be nice for https://github.com/m0smith/malabar-mode to have a groovy-send string function like this. I can submit a pull request is you are interested.


(defun groovy-send-string (str)
  "Send a string to the inferior Groovy process."
  (interactive "r")

  (save-excursion
    (save-restriction
      (let ((proc (groovy-proc)))

      (with-current-buffer (process-buffer proc)
    (while (and
        (goto-char comint-last-input-end)
        (not (re-search-forward comint-prompt-regexp nil t))
        (accept-process-output proc)))
    (goto-char (process-mark proc))
    (insert-before-markers str)
    (move-marker comint-last-input-end (point))
    (comint-send-string proc str)
    (comint-send-string proc "\n")
    )
      )
    )))
russel commented 9 years ago

Please feel free to convert this to a pull request, and I can then simply accept it! :-)

russel commented 9 years ago

Closing as the proposed change is now merged.