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
Ivan Grishaev
  • 1,583
  • 10
  • 15

1 Answers1

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
abo-abo
  • 20,038
  • 3
  • 50
  • 71