sly icon indicating copy to clipboard operation
sly copied to clipboard

M-, not working in Sly (works in Slime)

Open toddkfisher opened this issue 1 year ago • 10 comments

Test file:

(defun f ()
  (format t "f~%"))

(defun test ()
  (f))
  1. M-x sly
  2. C-c C-k
  3. Place cursor at call of f in function test.
  4. M-.
  5. Cursor jumps to (defun f().
  6. M-, : "At start of xref history" message in minibuffer and cursor remains at (defun f()

M-. and M-, work as expected in Slime.

toddkfisher avatar Nov 01 '24 18:11 toddkfisher

I can't reproduce.

aadcg avatar Nov 06 '24 17:11 aadcg

Can confirm this behavior on my system as well. However, if I run OPs example code and hit M-. I get an error:

sly-edit-definition: (((DEFUN FN) (:error Error: DEFINITION-SOURCE of function FN did not contain meaningful information.)))

On all other code I can go to the definitions, but I can't backtrack.

kflak avatar Feb 18 '25 12:02 kflak

I can't make heads or tails of this recipe. When you M-x sly in an Emacs -Q, it lands you in an SLY mREPL. And there, C-c C-k isn't bound to anything. So people here are talking about different things. Also I suspect the OP is in a Elisp buffer, not a Common Lisp one. Because that message is from ELisp's xref.el, which is not in use by SLY (I wish it was, but it's not).

So please, provide meaningful recipes starting from Emacs -Q some-lisp-file.lisp -l path-to-sly-autoloads.el -f sly or something like that.

joaotavora avatar Feb 18 '25 19:02 joaotavora

In my example, I wasn't in an elisp buffer and I was not in the sly mrepl. Note that I compiled with "C-c C-k" perfectly valid in a lisp buffer but not valid in an elisp buffer.

toddkfisher avatar Feb 18 '25 20:02 toddkfisher

See also:

https://github.com/slime/slime/commit/789584a7acb15747678fa62a8fcfc8d1187be867

and:

https://www.reddit.com/r/lisp/comments/ssqhrr/slimepopfinddefinitionstack_not_working/

toddkfisher avatar Feb 18 '25 20:02 toddkfisher

In my example, I wasn't in an elisp buffer and I was not in the sly mrepl. Note that I compiled with "C-c C-k" perfectly valid in a lisp buffer but not valid in an elisp buffer.

How am I to know that? You say "M-x sly" then "C-c C-k" it makes no sense.

joaotavora avatar Feb 18 '25 20:02 joaotavora

I still can't reproduce, and I'm using a super-duper latest Emacs from master. So post an idiot proof recipe, pretty please with sugar on top.

joaotavora avatar Feb 18 '25 20:02 joaotavora

I did a bit of investigation on my side with a minimal config:

(add-to-list 'load-path "~/build/sly") ; after pulling the git repo to this path
(require 'sly-autoloads)
(setq inferior-lisp-program "/usr/bin/sbcl")

When I evaluate the code that @toddkfisher suggested:

(defun f ()
  (format t "f~%"))

(defun test ()
  (f))

and hit M-. on the f in the test function I get an error:

(((DEFUN F) (:error Error: DEFINITION-SOURCE of function F did not contain meaningful information.)))

When, however, I did a simple M-. on #'+ then I could move back easily with M-,

So @toddkfisher there's something in our configs that interfers with M-,...

I am on 31.0.50 on Arch Linux, so quite close to the bleeding edge.

kflak avatar Feb 19 '25 08:02 kflak

Further digging: I wiped my entire config clean, and the problem persisted. However, it works fine when I use the version of sly that I pulled down from git and installed manually. Whenever I use melpa to install it the problem returns.

kflak avatar Feb 23 '25 05:02 kflak

Sounds like a duplicate of https://github.com/joaotavora/sly/discussions/691#discussioncomment-14917242.

I plan to make a release soon. In the meantime, please don't use MELPA stable.

aadcg avatar Nov 17 '25 13:11 aadcg