1
0
mirror of https://github.com/golang/go synced 2024-11-21 19:14:44 -07:00

misc/emacs: Fix the gofmt patching when the TMPDIR is not the default.

The previous code assumed the gofmt output referred to /tmp but
that's not true if TMPDIR points somewhere else (like on Macs).
Fixes #3782.

R=sameer
CC=golang-dev
https://golang.org/cl/6346050
This commit is contained in:
Jean-Marc Eurin 2012-06-29 12:49:31 -04:00 committed by Sameer Ajmani
parent fa6f9b4a3e
commit 11cafa3a42

View File

@ -820,7 +820,10 @@ Replace the current buffer on success; display errors on failure."
;; apply all the patch hunks
(with-current-buffer patchbuf
(goto-char (point-min))
(if (re-search-forward "^--- \\(/tmp/gofmt[0-9]*\\)" nil t)
;; The .* is for TMPDIR, but to avoid dealing with TMPDIR
;; having a trailing / or not, it's easier to just search for .*
;; especially as we're only replacing the first instance.
(if (re-search-forward "^--- \\(.*/gofmt[0-9]*\\)" nil t)
(replace-match filename nil nil nil 1))
(condition-case nil
(while t