branch: elpa/go-mode
commit 5ef1d53889304667a965ca35d2109a36edd9b2bc
Author: Alan Donovan <[email protected]>
Commit: Dominik Honnef <[email protected]>
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 <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
---
guru_import/cmd/guru/guru.el | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/guru_import/cmd/guru/guru.el b/guru_import/cmd/guru/guru.el
index 4133efa..d48d23b 100644
--- a/guru_import/cmd/guru/guru.el
+++ b/guru_import/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."