Opened 11 years ago

Closed 11 years ago

#550 closed defect (fixed)

Goto Definition (meta-.) should find the current version of function

Reported by: Kristian Bredin Owned by: gz
Priority: normal Milestone:
Component: IDE Version: 1.3
Keywords: Cc:


If there are multiple versions of a function definition in a file, Meta-. currently leads to the first occurrence.

It should instead find the valid (current) version of the function (the one that is evaluated last). This is oftentimes (but not always) the last version in the buffer.

Change History (5)

comment:1 Changed 11 years ago by Kristian Bredin

What's the status for this one?

comment:2 Changed 11 years ago by gb

Personally, I've been trying to figure out how to tactfully ask "why do you have multiple definitions of the same function, and why don't you fix that ?", but haven't been able to do so.

COMPILE-FILE (and LOAD of a .lisp file) go to some lengths to record the exact source location of a definition (and its subforms.) I don't think that much of anything besides some SLIME versions and DISASSEMBLE use that information. Obviously, M-. in the IDE should.

Having M-. know exactly where a definition came from would be a good thing and would incidentally address your issue. Otherwise expending effort to deal with cases where a file contains multiple definitions of the same function - when that situation is something that COMPILE-FILE warns about and we generally try to discourage - doesn't make a lot of sense to me, personally.

You seem to have these duplicate definitions intentionally. Is that correct ? If so, as tactfully as I can ask: why ?

comment:3 Changed 11 years ago by Kristian Bredin

Thank you for trying to ask in a tactful way. :)

Well, probably I shouldn't have multiple version of the same function in a file. But, then again, I should probably do some jogging, empty the trash can in my kitchen twice a day and give more of my salary to charity.

The frank answer to the question is that it's all part of my work flow. Eventually I do clean up the code, but in the (sometimes long) process of actually writing it, I find it natural to refine the same functions over and over, and indeed keep the increasingly older versions (the further up you look) for reference. I could of course file older versions of the file, and only have one version of the functions in the current file, but I do find it convenient to copy-paste the function body to a position just below the old one, and refine it from there. If something goes wrong, I can easily revert to the older version (in a running environment) by just evaluating the version just above the one that causes the error. This sort of work flow requires a mechanism to easily find the current version of the definition in question.

By the way, this did work in MCL.

comment:4 Changed 11 years ago by gz

  • Owner set to gz
  • Status changed from new to assigned

comment:5 Changed 11 years ago by gz

  • Resolution set to fixed
  • Status changed from assigned to closed

This should be fixed in r12635

Note: See TracTickets for help on using tickets.