Skip to content

CIDER session is lost when navigating to definition #3250

Closed
@mmontone

Description

@mmontone

Hi,

when navigating to a definition via xref-find-definition (M-.), if the target buffer is not part of the Clojure project I'm in, the buffer is 'unlinked', and so I cannot continue navigating or evaluate Clojure code in the new buffer, unless I manually link it with sesman-link-buffer.

So, I've added this to my .emacs, that propagates the current CIDER session to the definition buffer:

(defun cider--xref-show-definitions-buffer (fetcher alist)
  "Propagate the CIDER session to the definitions buffer."
  (let ((session (sesman-current-session 'CIDER)))
    (xref-show-definitions-buffer fetcher alist)
    (sesman-link-with-buffer nil session)))

(add-hook 'cider-mode-hook
	  (lambda ()
	    (setq-local xref-show-definitions-function 'cider--xref-show-definitions-buffer)))

Not sure if this is the best fix, but it does the job for me.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions