Improve the macroexpansion module#3971
Merged
Merged
Conversation
- Fix cider-macroexpand-again (g): it passed the original input form to the buffer as if it were the expansion, so it redisplayed the input instead of re-expanding. Store the expander and actually re-expand; error when there is nothing to repeat. - Add n / t in the macroexpansion buffer to cycle namespace display and toggle metadata, re-expanding in place, plus matching menu entries. - Drop a spurious (interactive) from the cider-macroexpand-expr-inplace helper, which requires an expander argument. - Add the module's first test suite and document the new keys.
Display the active expander and the current namespace/metadata display options, plus a reminder of the buffer's key bindings, so the state the new n/t toggles control is visible at a glance and the keys are discoverable.
The in-place expansion commands (m/a) re-expanded the sexp before point; make them target the form at point instead, so you can put point on a nested macro call in the expansion and drill into just that node (SLIME-style). This also makes the behavior match what the docs already described.
bbatsov
added a commit
that referenced
this pull request
Jun 18, 2026
Make the in-place expansion commands (m/a) target the sexp before point, like the entry commands and cider-macrostep, instead of the form at point. This restores a single, consistent CIDER convention across all macroexpansion entry points (the at-point variant from #3971 was inconsistent with the rest).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A pass over the separate-buffer macroexpansion module (
cider-macroexpansion.el) - a real bug fix, a UX addition, its first tests, and doc updates. (The inline macrostep work in #3970 is kept entirely separate.)Bug fix
cider-macroexpand-again(gin the macroexpansion buffer) stored the input form and passed it to the buffer as if it were the expansion, so it redisplayed the original instead of re-expanding. It now remembers the expander and re-runs the expansion (picking up macro redefinitions and display-option changes), and errors cleanly when nothing has been expanded yet.UX
nandtkeys (and menu entries) in the macroexpansion buffer: cyclecider-macroexpansion-display-namespaces(tidy->qualified->none) and togglecider-macroexpansion-print-metadata, re-expanding in place - so you can see the same expansion with/without namespaces or metadata without reconfiguring and re-running.Tidy
(interactive)from thecider-macroexpand-expr-inplacehelper (it requires anexpanderarg, so it was never validly interactive).Tests + docs
cider/macroexpandrequest construction + error handling, theagainre-expansion regression, the toggle/cycle commands, region redraw, keymap). Documented the new keys and clarified thegbehavior inmacroexpansion.adoc.