point-min
and point-max
are functions not variables.
So try this instead:
(shell-command-on-region (point-min) (point-max) "python -m json.tool")
Is there a way to use replace-regexp
with shell-command-on-region
?
Yes, but not combining them properly is not what the error message is about. But I can see where your confusion is coming from: "Error evaluating replacement expression:". That's additional information intended to help you figure out in what context the void-variable
error occurred. Unfortunately it did the opposite.
Edit: as pointed out in the comments there are a few more issues. I won't walk you though all of them; I suggest you read the documentation about the involved functions instead. But here is some code that should do the trick.
(let ((buf (generate-new-buffer " *temp*")))
(shell-command-on-region (point-min) (point-max)
"python -m json.tool" buf)
(with-current-buffer buf
(goto-char (point-min))
(replace-regexp "regexp" "replacement")
(buffer-string))
(kill-buffer buf))