Emacs has some nice facilities for interacting with external

processes. Recently I was working with an extremely long line with no

spaces that I wanted to split into lines of 72 characters. I banged

this out in about 20 seconds:

M-| (shell-command-on-region) perl -e '$_=<>;s/(.{72})/$1

/g;print'

Now,

Maybe I could have written this to a file and run perl on it using

the shell

the shell Maybe I could have used a keyboard macro, something like C-x ( C-u 7 2 C-f <RET> C-x ) C-x C-e e e e e ...

perhaps $_ <>= can be replaced with just <> or an appropriate command line switch, reducing my character count by two

<>= can be replaced with just or an appropriate command line switch, reducing my character count by two Maybe there is a function within emacs that does this already –

perhaps something similar to (let ((sentence-end "."))

(fill-paragraph nil)) (which doesn’t work)

However, interacting with the external process

a) worked first time and

b) made me feel clever

and sometimes, particularly in this kind of job, that is the most important thing.