{"action":"created","issue":{"url":"https://api.github.com/repos/rstudio/rstudio/issues/449","labels_url":"https://api.github.com/repos/rstudio/rstudio/issues/449/labels{/name}","comments_url":"https://api.github.com/repos/rstudio/rstudio/issues/449/comments","events_url":"https://api.github.com/repos/rstudio/rstudio/issues/449/events","html_url":"https://github.com/rstudio/rstudio/pull/449","id":90493610,"number":449,"title":"Implement special behaviours for setup chunk popup","user":{"login":"kevinushey","id":1976582,"avatar_url":"https://avatars.githubusercontent.com/u/1976582?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinushey","html_url":"https://github.com/kevinushey","followers_url":"https://api.github.com/users/kevinushey/followers","following_url":"https://api.github.com/users/kevinushey/following{/other_user}","gists_url":"https://api.github.com/users/kevinushey/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinushey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinushey/subscriptions","organizations_url":"https://api.github.com/users/kevinushey/orgs","repos_url":"https://api.github.com/users/kevinushey/repos","events_url":"https://api.github.com/users/kevinushey/events{/privacy}","received_events_url":"https://api.github.com/users/kevinushey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-23T21:24:03Z","updated_at":"2015-06-24T09:54:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rstudio/rstudio/pulls/449","html_url":"https://github.com/rstudio/rstudio/pull/449","diff_url":"https://github.com/rstudio/rstudio/pull/449.diff","patch_url":"https://github.com/rstudio/rstudio/pull/449.patch"},"body":"This PR implements special behaviours for the setup chunk.\r\n\r\n\r\n![setup-chunk](https://cloud.githubusercontent.com/assets/1976582/8317572/71ae71b0-19b3-11e5-8800-8ba2e2ea92e7.gif)\r\n\r\nBasic outline of how it works:\r\n\r\n1. The client asks the server to parse the chunk and scrape out the `opts_chunk$set` calls within,\r\n2. The UI is initialized based on the output of that parse,\r\n3. On each synchronization, the appropriate `knitr::opts_chunk$set` call is emitted at the bottom of the chunk, replacing the old call if it exists.\r\n\r\nI believe this is ready for merge, although we might prefer to refine some behaviours:\r\n\r\n- Should we make an attempt to preserve the original option order, or is it okay to take over and attempt to sort them in a sensible way? (ie by grouping options with similar functionality together in output)\r\n\r\n- Any other tweaks (additions or otherwise) we'd want to make to the setup chunk?"},"comment":{"url":"https://api.github.com/repos/rstudio/rstudio/issues/comments/114810216","html_url":"https://github.com/rstudio/rstudio/pull/449#issuecomment-114810216","issue_url":"https://api.github.com/repos/rstudio/rstudio/issues/449","id":114810216,"user":{"login":"jjallaire","id":104391,"avatar_url":"https://avatars.githubusercontent.com/u/104391?v=3","gravatar_id":"","url":"https://api.github.com/users/jjallaire","html_url":"https://github.com/jjallaire","followers_url":"https://api.github.com/users/jjallaire/followers","following_url":"https://api.github.com/users/jjallaire/following{/other_user}","gists_url":"https://api.github.com/users/jjallaire/gists{/gist_id}","starred_url":"https://api.github.com/users/jjallaire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjallaire/subscriptions","organizations_url":"https://api.github.com/users/jjallaire/orgs","repos_url":"https://api.github.com/users/jjallaire/repos","events_url":"https://api.github.com/users/jjallaire/events{/privacy}","received_events_url":"https://api.github.com/users/jjallaire/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T09:54:31Z","updated_at":"2015-06-24T09:54:31Z","body":"This looks great! Here's the final refinements I recommend:\r\n\r\n1. I think it's okay if we don't preserve the original option order (users that don't like our re-writing can just not use the UI)\r\n\r\n2. Let's have the option icon be right aligned in the setup chunk (i.e. where the Run button is in other chunks).\r\n\r\n3. I think we discussed *not* having the figure options be in the setup chunk (since they can/should be set in the YAML potentially on a per-format basis).\r\n\r\n4. We should have a header that indicates that these options are the document defaults. This could be in the form of bringing back the header element that I believe we stripped out of this component when we ported it from elsewhere in the code or it could just be some bolded text. I think the header should be: \"Default Chunk Options\"\r\n\r\n5. What do you think our default Rmd document should include for the setup chunk? We could have a call to `knitr::opts_chunk$set` *or* we could just have a simple comment saying: \r\n\r\n```r\r\n# setup chunk (load libraries, set chunk options, etc.) \r\n```\r\n\r\nI say this because it seems strange that we'd include a call to `knitr::opts_chunk$set` that just reflects the default Rmd options. Let me know what you think.\r\n\r\n\r\n"}}