I want to write an emacs function that does the following –
1) Start a new shell named “abc”.
2) Change the dir “/opt/abc”
3) In the dir run a shell command “python abc.py”
I have written the following function –
(defun abc-server ()
(interactive)
(shell-command "cd /opt/abc/")
(shell-command "python abc.py"))
The problem with the above –
1) It doesnt start a new shell
2) It doesnt change the dir.
3) When the cmd executes, it opens a browser window, which completely blocks any usage of emacs.
From
shell-command‘s docstring (C-h f shell-command):Also, combine it all into one command line.
shell-commandmakes a new shell every time, so the pwd will not persist from one invocation to another.