{"action":"created","issue":{"url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/1958","labels_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/1958/labels{/name}","comments_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/1958/comments","events_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/1958/events","html_url":"https://github.com/syl20bnr/spacemacs/pull/1958","id":87465452,"number":1958,"title":"window-purpose layer","user":{"login":"bmag","id":4334375,"avatar_url":"https://avatars.githubusercontent.com/u/4334375?v=3","gravatar_id":"","url":"https://api.github.com/users/bmag","html_url":"https://github.com/bmag","followers_url":"https://api.github.com/users/bmag/followers","following_url":"https://api.github.com/users/bmag/following{/other_user}","gists_url":"https://api.github.com/users/bmag/gists{/gist_id}","starred_url":"https://api.github.com/users/bmag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmag/subscriptions","organizations_url":"https://api.github.com/users/bmag/orgs","repos_url":"https://api.github.com/users/bmag/repos","events_url":"https://api.github.com/users/bmag/events{/privacy}","received_events_url":"https://api.github.com/users/bmag/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/syl20bnr/spacemacs/labels/New%20Layer","name":"New Layer","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/syl20bnr/spacemacs/milestones/5","html_url":"https://github.com/syl20bnr/spacemacs/milestones/release%200.106","labels_url":"https://api.github.com/repos/syl20bnr/spacemacs/milestones/5/labels","id":1408639,"number":5,"title":"release 0.106","description":"","creator":{"login":"syl20bnr","id":1243537,"avatar_url":"https://avatars.githubusercontent.com/u/1243537?v=3","gravatar_id":"","url":"https://api.github.com/users/syl20bnr","html_url":"https://github.com/syl20bnr","followers_url":"https://api.github.com/users/syl20bnr/followers","following_url":"https://api.github.com/users/syl20bnr/following{/other_user}","gists_url":"https://api.github.com/users/syl20bnr/gists{/gist_id}","starred_url":"https://api.github.com/users/syl20bnr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syl20bnr/subscriptions","organizations_url":"https://api.github.com/users/syl20bnr/orgs","repos_url":"https://api.github.com/users/syl20bnr/repos","events_url":"https://api.github.com/users/syl20bnr/events{/privacy}","received_events_url":"https://api.github.com/users/syl20bnr/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2015-11-12T15:39:58Z","updated_at":"2015-11-12T15:40:35Z","due_on":null,"closed_at":null},"comments":16,"created_at":"2015-06-11T19:24:46Z","updated_at":"2015-12-03T03:29:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/syl20bnr/spacemacs/pulls/1958","html_url":"https://github.com/syl20bnr/spacemacs/pull/1958","diff_url":"https://github.com/syl20bnr/spacemacs/pull/1958.diff","patch_url":"https://github.com/syl20bnr/spacemacs/pull/1958.patch"},"body":"After using a private layer for two months, I've started working on a proper contrib layer for [window-purpose](https://github.com/bmag/emacs-purpose). It is still a work-in-progress, and I'd like to hear any suggestions or questions you may have. Note that this PR doesn't try to replace anything currently in Spacemacs, just adds an optional layer that improves (IMHO) some parts of the window manager.\r\n\r\n**Here is what I've done or planning to do in this PR:**\r\n- [X] enable `window-purpose` package and define some key bindings\r\n- [X] extend `window-purpose` to give the same behavior as `popwin`, so there's (almost?) no regression in behavior for users. See extension `purpose-popwin.el`.\r\n- [x] make `window-purpose` and `popwin` play together nicely without conflicts\r\n- [x] empty `purpose-mode-map`, because by default it overrides <kbd>C-x C-f</kbd>, <kbd>C-x b</kbd>, etc. and conflicts with `semantic` over <kbd>C-c ,</kbd> key bindings.\r\n- [x] create a `helm-mini`-like helm command to use instead of `purpose-switch-buffer-with-purpose` and `purpose-switch-buffer-with-some-purpose`\r\n\r\n**Especially I'd appreciate advice about:**\r\n- <s>how to write the helm commands - I've had some bugs when I tried, maybe someone else can give it a try?</s>\r\n- key bindings: I've used the <kbd>SPC r</kbd> prefix (\"r\" for \"puRpose\"), since it's relatively short and doesn't have many other bindings. Do you prefer I use different keys?\r\n- extra purposes to configure for Spacemacs? I think the default purposes will be fine for now.\r\n- `window-purpose` has commands for saving/loading a window layout to/from file. I'm not sure what other methods Spacemacs has for saving/loading a window layout, so I didn't do anything about it yet.\r\n\r\n---\r\n\r\n**Some explanation about `window-purpose`:** (no need to read if you're familiar with the package)\r\n\r\nBasically, `window-purpose` is an alternative to the behavior of stock `display-buffer` and `switch-to-buffer`. When stock Emacs chooses a window for a buffer, it can either:\r\n- reuse a window that already shows that buffer\r\n- use some window that shows another buffer\r\n- create a new window/frame\r\n\r\nThe problem is that with \"use some window\" it's hard to predict where the window will open. `window-purpose` adds another option: \"reuse a window that shows another buffer that has the same purpose as the buffer that needs to be displayed.\"  This makes the behavior more predictable and makes the window layout more robust.\r\n\r\nAnother thing that `window-purpose` allows is to dedicate a window to a purpose (rather than a single buffer). So if, for example, I dedicate a window to the purpose `edit` (default purpose for code files), Emacs will use it only for code files and I can safely think of it as my code window. Similarly I can have a REPL\r\nwindow or any other type of window I may want - it's all customizable.\r\n\r\nWhat's more, there's an equivalent for `display-buffer-alist`, so we can define special behaviors for different kinds of windows. The first thing that comes to mind is that we can define a single consistent language-agnostic behavior for all the different REPLs in Spacemacs. \r\n\r\nAnother short-coming of stock Emacs, IMHO, is that `switch-to-buffer` doesn't follow the rules in `display-buffer`. `window-purpose` enforces its rules also on `switch-to-buffer`. Of course there are still differences between `switch-to-buffer`, `switch-to-buffer-other-window`, `switch-to-buffer-other-frame`, `pop-to-buffer`, `pop-to-buffer-same-window` and `display-buffer`, but now they all use the same mechanism."},"comment":{"url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/comments/161505519","html_url":"https://github.com/syl20bnr/spacemacs/pull/1958#issuecomment-161505519","issue_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/1958","id":161505519,"user":{"login":"robbyoconnor","id":23088,"avatar_url":"https://avatars.githubusercontent.com/u/23088?v=3","gravatar_id":"","url":"https://api.github.com/users/robbyoconnor","html_url":"https://github.com/robbyoconnor","followers_url":"https://api.github.com/users/robbyoconnor/followers","following_url":"https://api.github.com/users/robbyoconnor/following{/other_user}","gists_url":"https://api.github.com/users/robbyoconnor/gists{/gist_id}","starred_url":"https://api.github.com/users/robbyoconnor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbyoconnor/subscriptions","organizations_url":"https://api.github.com/users/robbyoconnor/orgs","repos_url":"https://api.github.com/users/robbyoconnor/repos","events_url":"https://api.github.com/users/robbyoconnor/events{/privacy}","received_events_url":"https://api.github.com/users/robbyoconnor/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T03:29:57Z","updated_at":"2015-12-03T03:29:57Z","body":":+1:\nOn 12/02/2015 10:24 PM, Tu Do wrote:\n> @bmag <https://github.com/bmag> You should integrate |window-purpose|\n> with |helm-find-files|. Current |purpose-find-file| has no action menu\n> for i.e. searching with |C-s|.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/syl20bnr/spacemacs/pull/1958#issuecomment-161504979>.\n>\n\n"}}