1

When I start working on my project, I need to run lots of processes. Currently, I have to launch each process in a manual way:

M-x multi-term RET
M-x rename-buffer RET *some-name* RET
cd ~/foo/bar/
python ./task.py

How to write a code on Emacs lisp that does the following steps:

  • opens new multi-term buffer;
  • renames it (I know the title I'd like to hardcode it for each process);
  • runs one or two commands inside terminal
3
  • 1
    Related: stackoverflow.com/a/17817119/1350992 Commented Jan 21, 2015 at 11:39
  • 2
    This isn't a comprehensive answer, so I'll add it as a comment. You might be interested in the prodigy.el package, a tool to "manage external services from within Emacs". Commented Jan 21, 2015 at 13:57
  • Yeah, prodigy.el seams exactly what I meant! Thanks. Commented Jan 22, 2015 at 9:57

1 Answer 1

2

You can start from this template:

(defun python-erica ()
  (interactive)
  (let* ((default-directory "~/")
         (proc (get-buffer-process
                (ansi-term "/usr/bin/ipython" "erica"))))
    (term-send-string
     proc
     (concat "import sys\n"))))

You can change:

  • function name
  • default dir
  • python executable
  • term buffer name
  • initial commands
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.