Skip to content

Project Search and Replace #765

Description

@countvajhula

A user asked on Discord whether there was a way to do project-wide renaming of bindings, and racket-xp-rename was suggested. But this only works on individual modules, and there's no notion of a "project" in Racket Mode or DrRacket.

Some Emacs packages do provide a definition of a "project." For example, for projectile, a project's files are derived as every file contained in the current Git repo's index. There may be other ways to get a project file listing that we could provide to Racket Mode.

I took a crack at using Projectile to list the project files, and then traverse those and apply racket-xp-rename. With a few modifications, I was able to get something to work:

Racket project search and replace [edit: fixed link]

But it does have at least one bug, where the defining module is itself renamed, in a require specification, to the new-id. That is, (require "path/to/source.rkt") becomes (require my-new-renamed-identifier)!

This approach does feel hacky to me, to begin with, but regardless of the specific approach, I thought it would be useful to create an issue to collect feedback and further ideas, as at least one other person reported that they resort to basic regex based replacement to do this project-wide, thus missing out on bindings-based replacement in racket-xp-rename which seems very useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions