2

As the examble like cookicutter, it have a read input in itself that we must type if we use it in normal terminal.

$> #comment: this is normal terminal emulator
$> cookiecutter $HOME/cookiecutter/script
$> enter script name: <we input here>
$> generate template....

Now I want to write a function that exec it from emacs ecosystem. I try:

(defun cookiecutter-el ()
  (interactive)
  
  (if (not (file-exists-p (concat (getenv "HOME") "/" "cookiecutter/")))
      (dired-create-directory (concat (getenv "HOME") "/" "cookiecutter/")))
  (setq cookiecutter-choose (completing-read "PROMT> "
                                             (split-string-and-unquote
                                              (shell-command-to-string "ls -1 (getenv "HOME") "/cookiecutter/") "\n" ) ))
  (eshell-command (concat "cookiecutter " "/home/larva/cookiecutter/"  cookiecutter-choose)))

or (call-process-shell-command) or something similar is not work. Because It only work with a process that have output or those process must be terminated. In case of cookiecutter, it requires we to input before it terminated the process.

As I remember, emacs-gdb multiwindow require we input from "input/output" window. I think emacs don't support deal with this case by default.

I can do easy thing like exec cookiecutter from terminal emulator, I just want to find out how things work

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.