rewrite-clj icon indicating copy to clipboard operation
rewrite-clj copied to clipboard

paredit/wrap-around returns nil if located on whitespace or comment

Open lread opened this issue 10 months ago • 0 comments

Version 1.1.49

Platform All

Symptom If zipper is located on whitespace, wrap-around returns nil.

Reproduction

(-> "1\n2"
    z/of-string
    z/right*
    (pe/wrap-around :vector))

Actual behavior

;; => nil

Expected behavior Let's see:

Option 1: No-op, return zloc unchanged.

Option 2: Wrap the whitespace node. Don't think this in the spirit of paredit.

Option 3: Wrap the next non-ws/non-comment node else no-op. This seems to match my doom emacs paredit. But this means the location of the zipper moves, which can be surprising. The user can always decide to locate to a non-ws non-comment node prior to wrap-around.

So, let's go for the least surprising/no-magic option 1, no-op:

;; => "1\n2"

Diagnosis Done.

Action I'll address.

lread avatar Feb 15 '25 16:02 lread