Subject: Re: bug#71435: interactive xref-find-definitions-at-mouse

From: Eli Zaretskii <[email-masked]>
Date: Mon, 10 Jun 2024 20:55:11 +0300

> From: Alan Donovan <[email-masked]>
> Date: Mon, 10 Jun 2024 13:26:59 -0400
> Cc: [email-masked], [email-masked], [email-masked], 
> 	[email-masked]
> 
> I can reliably reproduce the problem using this script:
> 
> ;; reproducer for use in emacs -Q:
> ;; invoke load-file on this file,
> ;; then follow the interactive steps at the very end.
> 
> (emacs-version) ; 29.3
> (require 'eglot) ; 1.17.0
> 
> ;; --- these steps are documented at
> ;;
> https://github.com/golang/tools/blob/master/gopls/doc/emacs.md#configuring-project-for-go-modules-in-emacs
> 
> 
> (require 'project) ; 0.11.0
> 
> (defun project-find-go-module (dir)
>   (when-let ((root (locate-dominating-file dir "go.mod")))
>     (cons 'go-module root)))
> 
> (cl-defmethod project-root ((project (head go-module)))
>   (cdr project))
> 
> (add-hook 'project-find-functions #'project-find-go-module)
> ;; -----
> 
> ; Use your favorite modifier; s is super, aka ⌘ key on Mac.
> (global-set-key (kbd "s-<mouse-1>") #'xref-find-definitions-at-mouse)
> 
> ;; This file comes from github.com/dominikh/go-mode.el@master.
> (load-file "~/w/go-mode.el/go-mode.el")
> 
> ;; Create a new Go buffer.
> (with-current-buffer (find-file "/tmp/a.go")
>   (eglot-ensure)
>   (insert "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println()\n}\n")
>   (set-buffer (current-buffer)))

All that is needed to reproduce such a basic problem?

Are you sure it isn't project-find-go-module that interferes here, for
example?

IOW, please try to systematically remove stuff from the recipe until
you find the culprit.  My guess is that it is some of the 3rd-party
stuff you load, not Emacs.