Skip to content

Commit fa3cfb6

Browse files
committed
adds a customization for how much of the filename gets truncated
The length of the filename in the go guru output was hardcoded to 20, and I wanted it longer, so I added a customization.
1 parent fdc1545 commit fa3cfb6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

go-guru.el

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@
6666
:type 'string
6767
:group 'go-guru)
6868

69+
(defcustom go-guru-truncate-file-length 20
70+
"The length to truncate the file name to in the output buffer."
71+
:type 'integer
72+
:group 'go-guru)
73+
6974
(defvar go-guru--scope-history
7075
nil
7176
"History of values supplied to `go-guru-set-scope'.")
@@ -231,9 +236,10 @@ output of the Go guru tool."
231236
(setq p (1- p)) ; exclude final space
232237
(let* ((posn (buffer-substring-no-properties start p))
233238
(flen (cl-search ":" posn)) ; length of filename
234-
(filename (if (< flen 19)
239+
(truncate (- (max go-guru-truncate-file-length 20) 1))
240+
(filename (if (< flen truncate)
235241
(substring posn 0 flen)
236-
(concat "" (substring posn (- flen 19) flen)))))
242+
(concat "" (substring posn (- flen truncate) flen)))))
237243
(put-text-property start p 'display filename)
238244
(forward-line 1)
239245
(setq start (point))))))))

0 commit comments

Comments
 (0)