Skip to content

Preview cljr-inline-symbol too - #596

Merged
bbatsov merged 1 commit into
masterfrom
inline-preview
Jul 12, 2026
Merged

bbatsov merged 1 commit into
masterfrom
inline-preview

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 12, 2026

Copy link
Copy Markdown
Member

Small follow-up to the refactoring preview: cljr-inline-symbol now goes through the same preview/confirm/undo path as cljr-rename-symbol and cljr-change-function-signature. Its edits are gathered and shown as a diff first, and nothing is written until you confirm.

Mechanically it's the established pattern - wrap the body in cljr--run-previewable-refactoring and turn its two save-buffer calls into cljr--save-buffer so they defer during a session. No new apply/abort logic (that all lives in the shared driver from the previous PR).

Validated live against a real refactor-nrepl connection: inlining a def previewed correctly, applied both usages + removed the definition on confirm, and left the file untouched on decline.

Route cljr-inline-symbol through cljr--run-previewable-refactoring, like
rename and change-signature: gather the edits, show a diff, and write
only on confirm. Its two save-buffer calls (after the occurrence loop and
in cljr--delete-definition) become cljr--save-buffer so they defer during
a preview session, and the success message is guarded on the edits
actually being applied.

Validated live against a real refactor-nrepl connection: inlining a def
(both usages replaced, definition removed) previewed and applied on
confirm, left untouched on decline.
@bbatsov
bbatsov merged commit aa49bbd into master Jul 12, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant