{"action":"closed","issue":{"url":"https://api.github.com/repos/Bad-ptr/persp-mode.el/issues/40","repository_url":"https://api.github.com/repos/Bad-ptr/persp-mode.el","labels_url":"https://api.github.com/repos/Bad-ptr/persp-mode.el/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/Bad-ptr/persp-mode.el/issues/40/comments","events_url":"https://api.github.com/repos/Bad-ptr/persp-mode.el/issues/40/events","html_url":"https://github.com/Bad-ptr/persp-mode.el/issues/40","id":158508525,"number":40,"title":"Automatically use projectile perspectives","user":{"login":"toupeira","id":6501,"avatar_url":"https://avatars.githubusercontent.com/u/6501?v=3","gravatar_id":"","url":"https://api.github.com/users/toupeira","html_url":"https://github.com/toupeira","followers_url":"https://api.github.com/users/toupeira/followers","following_url":"https://api.github.com/users/toupeira/following{/other_user}","gists_url":"https://api.github.com/users/toupeira/gists{/gist_id}","starred_url":"https://api.github.com/users/toupeira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toupeira/subscriptions","organizations_url":"https://api.github.com/users/toupeira/orgs","repos_url":"https://api.github.com/users/toupeira/repos","events_url":"https://api.github.com/users/toupeira/events{/privacy}","received_events_url":"https://api.github.com/users/toupeira/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-04T15:04:37Z","updated_at":"2016-06-06T10:41:20Z","closed_at":"2016-06-06T10:41:20Z","body":"I'm trying to automatically use project layouts for files that belong to a project, what I have so far is the following:\r\n\r\n```elisp\r\n  (def-auto-persp \"projectile\"\r\n    :hooks (projectile-mode-hook)\r\n    :predicate (lambda (buffer)\r\n                 (and (not (eq nil (buffer-file-name buffer)))\r\n                      (bound-and-true-p projectile-mode)\r\n                      (projectile-project-p)\r\n                      (projectile-project-buffer-p buffer (projectile-project-root))))\r\n    :on-match (lambda (perspective buffer after-match hook args)\r\n                  (persp-switch (projectile-project-root))))\r\n```\r\n\r\nI had to add the checks for `buffer-file-name` and `projectile-project-buffer-p` to avoid issues with things like Helm, but otherwise this seems to work nicely. So my question is basically: do you see any problems with this approach, or maybe there's a more straight-forward or reliable way to accomplish the same thing?"}}
{"actor":{"display_login":"toupeira"}}