Filtering text through a shell command in Emacs
In vi[m] there is the ! command which lets me pipe text through a shell command -- like sort or indent -- and get the filtered text back into the buffer. Is there an equivalent in emacs? You can select a region and type `C-u M-| command RET', and it replaces the region with the command output in the same buffer due to the interactive prefix argument of shell-command-on-region. I wrote this a few years back, it might help you: (defun generalized-shell-command (command arg) "Unifies `shell-command' and `shell-command-on-region'. If no region is selected, run a shell command just like M-x shell