   :type 'string
   :group 'go-guru)
 
+(defface go-guru-hl-identifier-face
+  '((t (:inherit highlight)))
+  "Face used for highlighting identifiers in `go-guru-hl-identifier'."
+  :group 'go-guru)
+
 (defcustom go-guru-debug nil
   "Print debug messages when running guru."
   :type 'boolean
   :group 'go-guru)
+
+(defcustom go-guru-hl-identifier-idle-time 0.5
+  "How long to wait after user input before highlighting the current identifier."
+  :type 'float
+  :group 'go-guru)
+
+(defvar go-guru--current-hl-identifier-idle-time
+  0
+  "The current delay for hl-identifier-mode.")
+
+(defvar go-guru--hl-identifier-timer
+  nil
+  "The global timer used for highlighting identifiers.")
 
 ;; Extend go-mode-map.
 (let ((m (define-prefix-command 'go-guru-map)))

  (interactive)
  (go-guru--run "whicherrs" t))

(provide 'go-guru)

;;; go-guru.el ends here

    (string-bytes (buffer-substring (point-min)
                                    (point-max)))))

;; FIXME(dominikh): go-guru--goto-pos-no-file and go-guru--goto-pos
;; assume that Guru is giving rune offsets in the columns field.
;; However, it is giving us byte offsets, causing us to highlight
;; wrong ranges as soon as there's any multi-byte runes in the line.
(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."
  (let ((file-line-pos (split-string posn ":")))
    (find-file (car file-line-pos))
    (goto-char (point-min))
    (forward-line (1- (string-to-number (cadr file-line-pos))))
    (forward-char (1- (string-to-number (caddr file-line-pos))))))

(defun go-guru--goto-pos-no-file (posn)
  "Given `file:line:col', go to the line and column. The file
component will be ignored."
  (let ((file-line-pos (split-string posn ":")))
    (goto-char (point-min))
    (forward-line (1- (string-to-number (cadr file-line-pos))))
    (forward-char (1- (string-to-number (caddr file-line-pos))))))

