    misc/emacs: Rewrite gofmt to use own function for applying patch instead of using diff-mode.
    misc/emacs: Rewrite gofmt to use own function for applying patch instead of using diff-mode.

    Instead of relying on gofmt's diff output (which is a unified
    diff), we manually invoke diff -n and produce an RCS format diff,
    which can easily be parsed in Emacs, with the go--apply-rcs-patch
    function.

    This fixes undocumented issues with the old implementation such as
    skipping over hunks of changes, and it fixes the documented issue
    of not being able to handle file names that include whitespace.

    It can also apply the patch on a buffer that has no file name
    attached at all.

    Last but not least, it greatly simplifies the gofmt function
    itself.

Fixes issue 4766.
Fixes issue 4475.

R=adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://codereview.appspot.com/7516046

Committer: Alan Donovan <7069e9552f9d110b0a0f326b96f22f63fb99dfc1@google.com>

gnanderson/go,pombredanne/go-deleteme,apparentlymart/golang,dsriram/golang,tv42/old-go,pombredanne/go-deleteme,gnanderson/go,pombredanne/go-deleteme,tv42/old-go,tv42/old-go,tv42/old-go,gnanderson/go,dsriram/golang,apparentlymart/golang,dsriram/golang,gnanderson/go,tv42/old-go,pombredanne/go-deleteme,tv42/old-go,apparentlymart/golang,apparentlymart/golang,apparentlymart/golang,apparentlymart/golang,dsriram/golang,gnanderson/go,dsriram/golang,pombredanne/go-deleteme,gnanderson/go,pombredanne/go-deleteme,dsriram/golang,pombredanne/go-deleteme,tv42/old-go,dsriram/golang,gnanderson/go,apparentlymart/golang