Search code examples
shellemacscommandinteractivemaxima

Emacs how to run command in Interactive command line mode in elisp


I am newbie to Emacs.

I want to define a function in elisp to run a command in interactive command line mode (Asynchronously if possible).

my current code is:

 (defun ma () ;run maxima batch on the current file
  (interactive) 
  (let* 
    ((fn (buffer-file-name)) (cmd (concat "maxima -b " fn)))    
    (message "cmd:%s" cmd)
    (shell-command cmd)
  )  
 )

this works fine when I do not have break points in the maxima code. When I have break points "break()", I have to interact with the program. The current shell-command function does not work.

I also like the mechanism of "shell-command" function that the screen will automatically split into two and show the programming running info in a second window. If possible, I still want this feature in the code that you can help me with.

Any help would be appreciated.


Solution

  • I want to define a function in elisp to run a command in interactive command line mode (Asynchronously if possible).

    Maybe async-shell-command is what you are looking for do C-h f async-shell-command RET for help on the function.