1

I have a program, say myprogram.exe, and I want to run it from within Emacs by using a key binding. I can run the program in the shell, but don't know how to write a function that calls this function and can be assigned a key binding.

Thanks

Renger

1 Answer 1

3

I give here only the basic ingredients as a starter kit.

Define an interactive command that calls myprogram.exe:

(defun myprog ()
 (interactive)
 (call-process "myprogram.exe"))

Now bind that command to the key of your liking:

(global-set-key (kbd "C-c p") #'myprog)
2
  • Thanks Tobias,works like a dream (I had written a script that sends a line from emacs to matlab and returns, so I can use matlab-mode and matlab on my windows machine) Jun 7, 2018 at 14:29
  • @arnyeinstein The standard way to indicate that the answer solves the problem is to accept it. (Click the green check mark.)
    – Tobias
    Jun 7, 2018 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.