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

ivy.el (ivy--reset-state): Filter sorted alist #1706

Closed
wants to merge 3 commits into from

Conversation

@basil-conto
Copy link
Collaborator

commented Aug 7, 2018

Fixes #1705

I've also simplified the surrounding code a bit in the subsequent two commits.

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Aug 8, 2018

Could you please resolve the merge conflict?

@basil-conto basil-conto force-pushed the basil-conto:blc/alist-pred branch Aug 8, 2018

@basil-conto

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 8, 2018

Could you please resolve the merge conflict?

Done, thanks.

(if (and sort (setq sort-fn (ivy--sort-function caller)))
(progn
(setq sort nil)
(sort (copy-sequence collection) sort-fn))

This comment has been minimized.

Copy link
@abo-abo

abo-abo Aug 9, 2018

Owner

Please be careful about removing copy-sequence. In all likelihood, there's a purpose for them:

;; oops:
(let ((coll '(("b" . "1") ("a" . "2"))))
  (ivy-with '(ivy-read "test:" coll
              :sort t)
            "C-m")
  coll)
;; => ((#("b" 0 1 (idx 1)) . "1"))

This comment has been minimized.

Copy link
@basil-conto

basil-conto Aug 9, 2018

Author Collaborator

Please be careful about removing copy-sequence.

I was, but clearly not enough. I was expecting cl-remove-if-not to allocate a new sequence, but I see now that it only does that on demand, which I don't think makes sense in the presence of cl-delete-if-not.

This comment has been minimized.

Copy link
@basil-conto

basil-conto Aug 9, 2018

Author Collaborator

Wow, cl-remove behaves totally differently to remove:

(let* ((seq (list 1 2 3))
       (sub (cl-remove 1 seq)))
  (setcar sub 5)
  seq) ; => (1 5 3)

I wonder if this is intentional or a bug.

This comment has been minimized.

Copy link
@basil-conto

basil-conto Aug 9, 2018

Author Collaborator

In any case, I've re-added the copy-sequence.

basil-conto added 3 commits Aug 7, 2018

@basil-conto basil-conto force-pushed the basil-conto:blc/alist-pred branch to 99cbb8b Aug 9, 2018

@abo-abo abo-abo closed this in 146f09d Aug 9, 2018

abo-abo added a commit that referenced this pull request Aug 9, 2018
@abo-abo

This comment has been minimized.

Copy link
Owner

commented Aug 9, 2018

Thanks.

@basil-conto basil-conto deleted the basil-conto:blc/alist-pred branch Aug 9, 2018

basil-conto added a commit to basil-conto/swiper that referenced this pull request Aug 21, 2018
Strip properties from returned alist candidate
Strip idx property from entire candidate returned

ivy.el (ivy-read): Strip idx property from entire candidate returned
following commit 4ca8786
"ivy.el: Avoid modifying alist collection".
ivy-test.el (ivy-read): Test idx property removal.

Re: abo-abo#1706
Fixes abo-abo#1724
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.