(defun buffer-to-shell()
(let (buffer mark-whole-buffer)))
(shell-command-on-region start end "sed s/foo/bar/") ;; start, end not defined
)
As you might see there are undefined variables start
and end
in the function call for shell-command-on-region
.
I would like the function buffer-to-shell
to just mark the whole active buffer and pass it's region fields to the shell command function. I do not know how to get those to fields out of the result of mark-whole-buffer
which I am assigning to the local variable buffer
(which also may be redundant.
Solution
(defun buffer-to-shell()
"push the whole buffer to shell command sed"
(interactive)
(shell-command-on-region (point-min) (point-max) "sed s/foo/bar/")
)
yields Wrong type argument: commandp, buffer-to-shell
buffer-to-shell
does not satisfy the predicatecommandp
- it is not a command. You need to add aninteractive
spec to make it a command.