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.

有帮助吗?

解决方案

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.

其他提示

Use the built in compile function in commint mode.

(defun ma (&optional filename)
  (interactive)
  (compile (format "maxima -b %s" (or filename (buffer-file-name))) t))

This will open up a new window and will show you the output of the program running. Commint mode means that the compilation process is interactive, you will be able to send input to the program from the compilation buffer.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top