I'd like to pass some selected text in a buffer to a python script. The python script will process the string and print the result to stdout. This output should replace the original string that was selected. Can this be done?
To tackle this, I first pass a selected buffer to my python script. Below is the elisp function that I wrote, following a similar function to implement the command
(defun it () (interactive) (shell-command (concat "echo " (buffer-substring (mark) (point)) " | /Users/john/bin/t ")))
This command succeeds and prints the output in the mini-buffer. Is there an elisp-way to overwrite the selected text with this output?