Commit 11cafa3a authored by Jean-Marc Eurin's avatar Jean-Marc Eurin Committed by Sameer Ajmani

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
parent fa6f9b4a
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment