{"action":"created","issue":{"url":"https://api.github.com/repos/emacs-helm/helm/issues/1509","repository_url":"https://api.github.com/repos/emacs-helm/helm","labels_url":"https://api.github.com/repos/emacs-helm/helm/issues/1509/labels{/name}","comments_url":"https://api.github.com/repos/emacs-helm/helm/issues/1509/comments","events_url":"https://api.github.com/repos/emacs-helm/helm/issues/1509/events","html_url":"https://github.com/emacs-helm/helm/issues/1509","id":155648889,"number":1509,"title":"Unexpected behavior with `helm-preselect`","user":{"login":"xiongtx","id":1624090,"avatar_url":"https://avatars.githubusercontent.com/u/1624090?v=3","gravatar_id":"","url":"https://api.github.com/users/xiongtx","html_url":"https://github.com/xiongtx","followers_url":"https://api.github.com/users/xiongtx/followers","following_url":"https://api.github.com/users/xiongtx/following{/other_user}","gists_url":"https://api.github.com/users/xiongtx/gists{/gist_id}","starred_url":"https://api.github.com/users/xiongtx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiongtx/subscriptions","organizations_url":"https://api.github.com/users/xiongtx/orgs","repos_url":"https://api.github.com/users/xiongtx/repos","events_url":"https://api.github.com/users/xiongtx/events{/privacy}","received_events_url":"https://api.github.com/users/xiongtx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-05-19T03:47:49Z","updated_at":"2016-09-12T16:01:25Z","closed_at":"2016-08-12T20:11:20Z","body":"## Problem\r\n\r\nI am encountering some unexpected behavior with the `:preselect` keyword for the `helm` command. Consider the example below:\r\n\r\n```emacs-lisp\r\n(helm :sources (list (helm-build-sync-source \"foo\"\r\n                       :candidates '(\"a\" \"b\" \"c\"))\r\n                     (helm-build-sync-source \"bar\"\r\n                       :candidates '(1 2 3)))\r\n      :buffer \"*Helm test*\"\r\n      :preselect \"bar\")\r\n```\r\n\r\nThe selection overlay is moved to `1`, which is unexpected, since none of the candidates in the two sources match `bar`. In the case of no match, I would expect the selection overlay to be placed on the first line of the first source--in this case, on `a`.\r\n\r\nLooking at the [source](https://github.com/emacs-helm/helm/blob/master/helm.el#L4288) for `helm-preselect`, it seems that the preselection is done by searching through the Helm buffer. Might this phenomenon be due to the regexp matching the source name?"},"comment":{"url":"https://api.github.com/repos/emacs-helm/helm/issues/comments/246396634","html_url":"https://github.com/emacs-helm/helm/issues/1509#issuecomment-246396634","issue_url":"https://api.github.com/repos/emacs-helm/helm/issues/1509","id":246396634,"user":{"login":"xiongtx","id":1624090,"avatar_url":"https://avatars.githubusercontent.com/u/1624090?v=3","gravatar_id":"","url":"https://api.github.com/users/xiongtx","html_url":"https://github.com/xiongtx","followers_url":"https://api.github.com/users/xiongtx/followers","following_url":"https://api.github.com/users/xiongtx/following{/other_user}","gists_url":"https://api.github.com/users/xiongtx/gists{/gist_id}","starred_url":"https://api.github.com/users/xiongtx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiongtx/subscriptions","organizations_url":"https://api.github.com/users/xiongtx/orgs","repos_url":"https://api.github.com/users/xiongtx/repos","events_url":"https://api.github.com/users/xiongtx/events{/privacy}","received_events_url":"https://api.github.com/users/xiongtx/received_events","type":"User","site_admin":false},"created_at":"2016-09-12T16:01:25Z","updated_at":"2016-09-12T16:01:25Z","body":"At the risk of beating a dead horse, I'm not sure where we left off on the issue of `helm-preselect` with a string source name.\r\n\r\nThe documentation for `helm-preselect` suggests that this *should* be accepted:\r\n\r\n> Argument SOURCE is a valid source name or a source alist\r\n\r\nBut this is currently broken due to the use of \r\n\r\n```emacs-lisp\r\n    (helm-display-mode-line (or source (helm-get-current-source)))\r\n```\r\n\r\nwhich assumes that `source` is always a list.\r\n\r\nIf we must use an actual source, we should:\r\n\r\n- Change the docstring to remove reference to source name\r\n- Provide a way to get a source from a source name for a current Helm session\r\n"}}
{"actor":{"display_login":"xiongtx"}}