1

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 ()
  (interactive)
  (let ((term-buf (get-buffer "*ansi-term*")))
    (unless term-buf
      (display-buffer
       (save-window-excursion
         (save-current-buffer
           (setq term-buf (ansi-term (or explicit-shell-file-name
                     (getenv "ESHELL")
                     shell-file-name)))))))
    (isend-associate (buffer-name term-buf))))
(define-key global-map [C-return] 'isend-with-ansi-term)

0

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.