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

paredit considers a seq of #_uneval nodes empty #338

Closed
lread opened this issue Feb 6, 2025 · 0 comments · Fixed by #359
Closed

paredit considers a seq of #_uneval nodes empty #338

lread opened this issue Feb 6, 2025 · 0 comments · Fixed by #359

Comments

@lread
Copy link
Collaborator

lread commented Feb 6, 2025

Version
1.1.49

Platform
All

Symptom
The paredit API treats empty sequences as special.
When the zipper is at an empty sequence (because we can't be in an empty sequence) we slurp into that sequence.

The paredit API deems a sequence with #_uneval nodes empty.
I don't think it should.

Reproduction

(-> "[#_uneval] 2"
    z/of-string
    pe/slurp-forward
    z/root-string)

Actual behavior

;; => "[#_uneval 2]"

Expected behavior
Should be a no-op because the sequence is not empty.

;; => "[#_uneval] 2"

To slurp into a non-empty sequence we navigate into it:

(-> "[#_uneval] 2"
    z/of-string
    z/down ;; nav down into non-empty seq
    slurp-forward
    z/root-string)
;; => "[#_uneval 2]"

Diagnosis
Closely related to #336.

Action
Working on it.

@lread lread changed the title paredit consider a seq of #_uneval nodes empty paredit considers a seq of #_uneval nodes empty Feb 18, 2025
lread added a commit that referenced this issue Feb 18, 2025
Because of #256, slurp fns had to be rewritten. During rewriting:

- address design flaw by deprecating existing `slurp` fns and adding
replacement `slurp-`*`-into` fns (closes #339)
- stop adding space char when preserving slurped newlines (closes #345)
- review ambiguous `-slurp-`*-`fully` fn behaviour (closes #341)
- when slurping, don't consider a node with `#_` uneval nodes
empty (closes #338)
- don't throw on rewrite-clj parseable but invalid clojure
`{:a}` (closes #336)
- slurping forward fully no longer throws when slurping into an empty
seq that is last item in a seq (closes #335)
- slurping backward at empty-seq at start of seq no longer
throws (closes #334)
- slurp forward now slurps when at empty-seq at end of seq (closes #333)
@lread lread closed this as completed in 3954f58 Feb 18, 2025
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 a pull request may close this issue.

1 participant