Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag sexp backwards command causes unexpected outcome in specific situation #2735

Open
bpringe opened this issue Feb 22, 2025 · 1 comment
Open
Labels
bug Something isn't working paredit Paredit and structural editing

Comments

@bpringe
Copy link
Member

bpringe commented Feb 22, 2025

(defn mirror-tree
  [tree]
  (when tree
    (let [[root left right] tree]
      [root (mirror-tree left) |(mirror-tree right)])))

When I put my cursor at | in the above code, in the bottom vector before the last sexp, and I run the command to drag the sexp backwards, it moves it to the front of the vector, rather than swapping it with the previous, as I expect.

Same thing happens if I put that code in a file by itself.

@bpringe bpringe added bug Something isn't working paredit Paredit and structural editing labels Feb 22, 2025
@PEZ
Copy link
Collaborator

PEZ commented Feb 22, 2025

I think I know what's happening. Calva probably misidentifies this as a let binding. (Within let, and other binding forms, the drag operations drag pairs. The result when dragging when there are an uneven number of elements in the binding form is somewhat undefined.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working paredit Paredit and structural editing
Projects
None yet
Development

No branches or pull requests

2 participants