The following code (from here) allows to send lines of code to an open *ansi-term* buffer via C-RET. It works well but the very first time I hit C-RET, the current line is not sent (nothing happens). Only from then on does C-RET send the current line to the *ansi-term* buffer. Why is the additional C-RET required in the beginning?

(defun isend-with-ansi-term ()
  (let ((term-buf (get-buffer "*ansi-term*")))
    (unless term-buf
           (setq term-buf (ansi-term (or explicit-shell-file-name
                     (getenv "ESHELL")
    (isend-associate (buffer-name term-buf))))
(define-key global-map [C-return] 'isend-with-ansi-term)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.