Commit cbcf358d authored by Mats Lidell's avatar Mats Lidell Committed by Sameer Ajmani

misc/emacs: Replace replace-{string|regexp} for XEmacs compatible code

Use code to be used in lisp programs as suggested in the doc strings for
replace-{string|regexp}. Bonus: This code works for XEmacs.

R=golang-dev, sameer, jmeurin
CC=golang-dev
https://golang.org/cl/6296073
parent 7f689864
...@@ -819,8 +819,9 @@ Replace the current buffer on success; display errors on failure." ...@@ -819,8 +819,9 @@ Replace the current buffer on success; display errors on failure."
(require 'diff-mode) (require 'diff-mode)
;; apply all the patch hunks ;; apply all the patch hunks
(with-current-buffer patchbuf (with-current-buffer patchbuf
(replace-regexp "^--- /tmp/gofmt[0-9]*" (concat "--- " filename) (goto-char (point-min))
nil (point-min) (point-max)) (if (re-search-forward "^--- \\(/tmp/gofmt[0-9]*\\)" nil t)
(replace-match filename nil nil nil 1))
(condition-case nil (condition-case nil
(while t (while t
(diff-hunk-next) (diff-hunk-next)
...@@ -831,9 +832,10 @@ Replace the current buffer on success; display errors on failure." ...@@ -831,9 +832,10 @@ Replace the current buffer on success; display errors on failure."
(defun gofmt-process-errors (filename errbuf) (defun gofmt-process-errors (filename errbuf)
;; Convert the gofmt stderr to something understood by the compilation mode. ;; Convert the gofmt stderr to something understood by the compilation mode.
(with-current-buffer errbuf (with-current-buffer errbuf
(beginning-of-buffer) (goto-char (point-min))
(insert "gofmt errors:\n") (insert "gofmt errors:\n")
(replace-string gofmt-stdin-tag (file-name-nondirectory filename) nil (point-min) (point-max)) (if (search-forward gofmt-stdin-tag nil t)
(replace-match (file-name-nondirectory filename) nil t))
(display-buffer errbuf) (display-buffer errbuf)
(compilation-mode))) (compilation-mode)))
......
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