Skip to content

Commit

Permalink
Merge pull request #1 from cbbaker/custom-filename-truncation-length
Browse files Browse the repository at this point in the history
adds a customization for how much of the filename gets truncated
  • Loading branch information
cbbaker authored Aug 12, 2019
2 parents fdc1545 + cf78756 commit 945a9a6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions go-guru.el
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
:type 'string
:group 'go-guru)

(defcustom go-guru-truncate-file-length 20
"The length to truncate the file name to in the output buffer."
:type 'integer
:group 'go-guru)

(defvar go-guru--scope-history
nil
"History of values supplied to `go-guru-set-scope'.")
Expand Down Expand Up @@ -231,9 +236,10 @@ output of the Go guru tool."
(setq p (1- p)) ; exclude final space
(let* ((posn (buffer-substring-no-properties start p))
(flen (cl-search ":" posn)) ; length of filename
(filename (if (< flen 19)
(truncate (- (max go-guru-truncate-file-length 20) 1))
(filename (if (< flen truncate)
(substring posn 0 flen)
(concat "" (substring posn (- flen 19) flen)))))
(concat "" (substring posn (- flen truncate) flen)))))
(put-text-property start p 'display filename)
(forward-line 1)
(setq start (point))))))))
Expand Down

0 comments on commit 945a9a6

Please sign in to comment.