emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/go-mode 5ef1d53 355/495: cmd/guru: use byte (not rune) cou


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 5ef1d53 355/495: cmd/guru: use byte (not rune) count in -modified archive
Date: Sat, 7 Aug 2021 09:05:47 -0400 (EDT)

branch: elpa/go-mode
commit 5ef1d53889304667a965ca35d2109a36edd9b2bc
Author: Alan Donovan <adonovan@google.com>
Commit: Dominik Honnef <dominik@honnef.co>

    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 <dominik@honnef.co>
    Reviewed-by: Michael Matloob <matloob@golang.org>
---
 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]