emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding refactoring capabilities to Emacs


From: João Távora
Subject: Re: Adding refactoring capabilities to Emacs
Date: Thu, 7 Sep 2023 17:49:25 +0100

On Thu, Sep 7, 2023 at 5:20 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> We could extend it to a full code-walker that can distinguish between
> identifiers that refer to functions vs variables and which skips "data"
> and obeys scope, and thus collect reliably all the references.
> But `cconv-analyze-form` is probably a better starting point :-)

But cconv-analyze-form takes a pre-read form, you've lost all source code
info by then.

> Going back from there to the actual source code can be a fair bit more
> tricky,

Exactly.

> but Alan's symbols-with-positions should provide just what we need.

Great! but how?

Some years ago I presented a full source-tracking reader for Common Lisp
with just Lisp to a conference ;-) Needs a programmable reader though :-(
As you may remember, I then paired it with a full code walker to create
a stepper.

Is lread.c used for symbols-with-positions, or is code read in some
other completely new way?

> > IMO diff is the lingua franca for communicating changes to source
> > code around the world, even in those pretty web interfaces that
> > you and many others like.  So it makes full sense to support it
> > and to support it well.
>
> +1, tho I think the general framework should be agnostic to the specific
> way a change is presented to the user.

Of course, but I don't understand the "tho", since that's exactly
what I described.  Presenting edits to the user is just the last step
after collecting them.   We should have a goodinternal representation
for a change, which is easy to manipulate, easy to apply to buffers,
and easy to view from many formats.  LSP's representation (a range
and a string with a null string for deletions) is not bad IMO, and
I see no reason to stray from it.

João



reply via email to

[Prev in Thread] Current Thread [Next in Thread]