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: Eshel Yaron
Subject: Re: Adding refactoring capabilities to Emacs
Date: Sat, 19 Aug 2023 12:58:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

> The main point of this is that it's high time Emacs had sophisticated
> and flexible support for code refactoring.  Let's start working on
> this!

That'd be really great!  I'd love to assist, if I can.

My initial thinking is that it may be useful to consider two categories
of refactoring operations:

1. Common transformations that make sense in most languages.  These
include renaming identifiers, reordering definitions/directives (such as
import statements), extracting blocks of code as standalone functions
and probably a few more.  IMO it'd be great if Emacs had standard
commands and user options for these refactor operations across major
modes.  For some languages, it might be difficult to provide some of
these transformations even though they're clearly useful, so some major
mode might want to indicate that they do not support some of these
transformations.  For instance, renaming identifiers requires very
precise knowledge of scoping and namespacing that might not be available
to some major modes (at least not without a lot more work).

2. Transformations that only make sense for a specific set of languages.
For example, in Prolog we may want to move the unification of some term
from the head of a clause to the start of its body.  That's a useful
transformation that doesn't alter the program's semantics, but I can't
think of a corresponding transformation in functional/imperative
languages.  Perhaps for such operations Emacs could allow major modes to
provide language-specific extensions to the refactoring facility.


-- 
Best,

Eshel



reply via email to

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