[gnu.emacs] Whoops! Fix for shell-command-on-buffer

worley@EDDIE.MIT.EDU (Dale Worley) (10/26/88)

The definition I gave for shell-command-on-buffer didn't work if there
was no mark set in the buffer.  This should fix the problem:

(defun shell-command-on-buffer (command &optional flag)
  "Execute string COMMAND in inferior shell with buffer as input;
display output (if any) in temp buffer;
Prefix arg means replace the buffer with it."
  (interactive "sShell command (on buffer): \nP")
  (if flag
      (progn
	(goto-char (point-min))
	(push-mark (point-max))))
  (shell-command-on-region (point-min) (point-max) command flag t))

Dale