{"action":"created","issue":{"url":"https://api.github.com/repos/clojure-emacs/cider/issues/919","labels_url":"https://api.github.com/repos/clojure-emacs/cider/issues/919/labels{/name}","comments_url":"https://api.github.com/repos/clojure-emacs/cider/issues/919/comments","events_url":"https://api.github.com/repos/clojure-emacs/cider/issues/919/events","html_url":"https://github.com/clojure-emacs/cider/issues/919","id":52536482,"number":919,"title":"I would like to automatically do the namespace setting on jack-in","user":{"login":"nicferrier","id":245513,"avatar_url":"https://avatars.githubusercontent.com/u/245513?v=3","gravatar_id":"","url":"https://api.github.com/users/nicferrier","html_url":"https://github.com/nicferrier","followers_url":"https://api.github.com/users/nicferrier/followers","following_url":"https://api.github.com/users/nicferrier/following{/other_user}","gists_url":"https://api.github.com/users/nicferrier/gists{/gist_id}","starred_url":"https://api.github.com/users/nicferrier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicferrier/subscriptions","organizations_url":"https://api.github.com/users/nicferrier/orgs","repos_url":"https://api.github.com/users/nicferrier/repos","events_url":"https://api.github.com/users/nicferrier/events{/privacy}","received_events_url":"https://api.github.com/users/nicferrier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-12-19T22:35:52Z","updated_at":"2015-01-27T17:10:36Z","closed_at":null,"body":"Why do I have to do cider-jack-in and then C-c M-n? My fingers hurt. I just want to do one thing and have it setup. If I switch files maybe I'd be happy to change the namespace.\r\n\r\nIt seems this is a matter of getting nrepl to understand where it came from. It seems doable to me but it also seems obvious. Which makes me think there's a reason it hasn't been done?"},"comment":{"url":"https://api.github.com/repos/clojure-emacs/cider/issues/comments/71686094","html_url":"https://github.com/clojure-emacs/cider/issues/919#issuecomment-71686094","issue_url":"https://api.github.com/repos/clojure-emacs/cider/issues/919","id":71686094,"user":{"login":"pbostrom","id":1334481,"avatar_url":"https://avatars.githubusercontent.com/u/1334481?v=3","gravatar_id":"","url":"https://api.github.com/users/pbostrom","html_url":"https://github.com/pbostrom","followers_url":"https://api.github.com/users/pbostrom/followers","following_url":"https://api.github.com/users/pbostrom/following{/other_user}","gists_url":"https://api.github.com/users/pbostrom/gists{/gist_id}","starred_url":"https://api.github.com/users/pbostrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pbostrom/subscriptions","organizations_url":"https://api.github.com/users/pbostrom/orgs","repos_url":"https://api.github.com/users/pbostrom/repos","events_url":"https://api.github.com/users/pbostrom/events{/privacy}","received_events_url":"https://api.github.com/users/pbostrom/received_events","type":"User","site_admin":false},"created_at":"2015-01-27T17:10:36Z","updated_at":"2015-01-27T17:10:36Z","body":"@nicferrier Here is some elisp to do what you want:\r\n```elisp\r\n(defun cider-ji-and-switch-ns ()\r\n  (interactive)\r\n  (cider-jack-in)\r\n  (add-hook 'nrepl-connected-hook\r\n    (lambda ()\r\n      (cider-switch-to-last-clojure-buffer)\r\n      (cider-repl-set-ns (cider-current-ns))\r\n      (cider-switch-to-repl-buffer))))\r\n```\r\nThen I mapped this to C-c M-y:\r\n`(define-key clojure-mode-map (kbd \"C-c M-y\") 'cider-ji-and-switch-ns)`"}}