From 86372b3255bd23c074d3112bdb87052e725463ed Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Sat, 20 Feb 2016 16:14:17 -0500 Subject: [PATCH] cmd/guru: use byte (not rune) count in -modified archive Change-Id: I7fc575c8ec7a8170e64719419079d6742f47b119 Reviewed-on: https://go-review.googlesource.com/19744 Reviewed-by: Dominik Honnef Reviewed-by: Michael Matloob --- cmd/guru/guru.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/guru/guru.el b/cmd/guru/guru.el index 4133efa3d2..d48d23bc4e 100644 --- a/cmd/guru/guru.el +++ b/cmd/guru/guru.el @@ -192,10 +192,18 @@ current buffer in the format specified by guru's -modified flag." (progn (insert (format "%s\n%d\n" (buffer-file-name b) - (buffer-size b))) - (insert-buffer-substring b)))) + (go-guru--buffer-size-bytes b))) + (insert-buffer-substring b)))) (buffer-list))) +(defun go-guru--buffer-size-bytes (&optional buffer) + "Return the number of bytes in the current buffer. +If BUFFER, return the number of characters in that buffer instead." + (with-current-buffer (or buffer (current-buffer)) + (string-bytes (buffer-substring (point-min) + (point-max))))) + + (defun go-guru--goto-pos (posn) "Find the file containing the position POSN (of the form `file:line:col') set the point to it, switching the current buffer."