{"action":"created","issue":{"url":"https://api.github.com/repos/abo-abo/swiper/issues/553","repository_url":"https://api.github.com/repos/abo-abo/swiper","labels_url":"https://api.github.com/repos/abo-abo/swiper/issues/553/labels{/name}","comments_url":"https://api.github.com/repos/abo-abo/swiper/issues/553/comments","events_url":"https://api.github.com/repos/abo-abo/swiper/issues/553/events","html_url":"https://github.com/abo-abo/swiper/issues/553","id":159837418,"number":553,"title":"Trouble understanding sorting #1","user":{"login":"jkitchin","id":1610070,"avatar_url":"https://avatars.githubusercontent.com/u/1610070?v=3","gravatar_id":"","url":"https://api.github.com/users/jkitchin","html_url":"https://github.com/jkitchin","followers_url":"https://api.github.com/users/jkitchin/followers","following_url":"https://api.github.com/users/jkitchin/following{/other_user}","gists_url":"https://api.github.com/users/jkitchin/gists{/gist_id}","starred_url":"https://api.github.com/users/jkitchin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkitchin/subscriptions","organizations_url":"https://api.github.com/users/jkitchin/orgs","repos_url":"https://api.github.com/users/jkitchin/repos","events_url":"https://api.github.com/users/jkitchin/events{/privacy}","received_events_url":"https://api.github.com/users/jkitchin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-12T17:10:21Z","updated_at":"2016-06-13T15:39:33Z","closed_at":null,"body":"1. If I run this, and type C-M-m, or C-M-o o the candidates are sorted, but reduced in number by 1 (I lose \"a\"). Interestingly if I exit and then ivy-resume, they are all there. Is this not the right way to sort the candidates?\r\n\r\n```\r\n#+BEGIN_SRC emacs-lisp\r\n(ivy-read \"string: \" '(\"b\" \"a\" \"d\" \"c\")\r\n\t  :action '(1\r\n\t\t    (\"o\"\r\n\t\t     (lambda (x)\t\t       \r\n\t\t       (setf (ivy-state-collection ivy-last)\r\n\t\t\t     (setq ivy--all-candidates\r\n\t\t\t\t   (sort ivy--all-candidates 'string-lessp))))\r\n\t\t     \"sort a-z\")))\r\n#+END_SRC\r\n```"},"comment":{"url":"https://api.github.com/repos/abo-abo/swiper/issues/comments/225619714","html_url":"https://github.com/abo-abo/swiper/issues/553#issuecomment-225619714","issue_url":"https://api.github.com/repos/abo-abo/swiper/issues/553","id":225619714,"user":{"login":"jkitchin","id":1610070,"avatar_url":"https://avatars.githubusercontent.com/u/1610070?v=3","gravatar_id":"","url":"https://api.github.com/users/jkitchin","html_url":"https://github.com/jkitchin","followers_url":"https://api.github.com/users/jkitchin/followers","following_url":"https://api.github.com/users/jkitchin/following{/other_user}","gists_url":"https://api.github.com/users/jkitchin/gists{/gist_id}","starred_url":"https://api.github.com/users/jkitchin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkitchin/subscriptions","organizations_url":"https://api.github.com/users/jkitchin/orgs","repos_url":"https://api.github.com/users/jkitchin/repos","events_url":"https://api.github.com/users/jkitchin/events{/privacy}","received_events_url":"https://api.github.com/users/jkitchin/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T15:39:33Z","updated_at":"2016-06-13T15:39:33Z","body":"This looks pretty good. Is there a way to preserve the current candidate? e.g. if the current selection is on b, and you type \"C-M-o o\", the candidates are sorted, and the current selection is still on b?\r\n\r\nthe ivy-reset-collection doesn't look right to me. It would work for collections of strings, where (ivy-state-collection ivy-last) and ivy--all-candidates are the same, but not when (ivy-state-collection ivy-last) is a list of cons cells, or lists right?\r\n\r\nThis is what I mean:\r\n```\r\n#+BEGIN_SRC emacs-lisp \r\n(defvar input '((\"b 1\" . 1) (\"a 2\" . 2) (\"d 0\" . 0) (\"c 5\" . 5)))\r\n\r\n(ivy-read \"string: \" input\r\n          :action\r\n          '(1\r\n            (\"o\" (lambda (x) \r\n                   (setq res (list (ivy-state-collection ivy-last) ivy--all-candidates))))))\r\n\r\nres\r\n#+END_SRC\r\n#+RESULTS:\r\n| (d 0 . 0) | (c 5 . 5) | (b 1 . 1) | (a 2 . 2) |\r\n| d 0       | c 5       | b 1       | a 2       |\r\n\r\n```\r\n\r\nivy--all-candidates are the strings, and (ivy-state-collection ivy-last) is the cons cells. Won't ivy-reset-collection like above clobber the cons cells?"}}
{"actor":{"display_login":"jkitchin"}}