-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #1281 - window-purpose layer #1958
Conversation
Nice work... Do you know if this plays nice with eyebrowse? |
I haven't started using eyebrowse yet, so I don't know. I hope it does. If it doesn't, I'll have to figure out something. EDIT: a short test reveals that for the purpose-dedication state to be saved and restored when switching workspaces, you need to run this code: (setq window-persistent-parameters (append '((purpose-dedicated . writable)) window-persistent-parameters)) That code should probably be added upstream to |
This PR is ready to merge. Any questions, suggestions, objections, etc? @rphillips it should play nice with eyebrowse now. |
I'm really excited to try this out. |
@tuhdo glad to hear that. Found and fixed a minor issue with eyebrowse. Basically this layer is ready and usable, but it is likely some (currently unknown) packages will require some tweaking to work with it. I'm prepared to fix any such issues we might find. |
Added to milestone 0.105 |
16851f5
to
2f1bec6
Compare
I hope this works with perspectives layer as well x3 |
Any chance of rebasing this? |
@CestDiego Most of what it does is to change the behavior of @robbyoconnor Will rebase it later today or tomorrow, but right now I don't have time |
dc58e4f
to
2c00d24
Compare
rebased and squashed |
👍 ❤️ |
@bmag hi, tried your PR as a private layer but failed to pass the tests when loading. Should it be fine ? |
@fatlazycat what tests are you referring to? I am also using it as a private layer, without a problem. Perhaps it's an installation issue? |
@bmag odd must have been PEBKAC, tried it again and loaded fine. Thanks. |
@bmag You should integrate |
👍
|
@tuhdo I think you meant |
updated and rebased |
This is very very nice. |
I want to use this for tdd. Right now I'm learning emacs and run ert tests and it opens new buffer and I need to type 'q' to quit because it switches focus. Does anyone know how to run command and NOT switch buffers? Or some solution to stay in buffer where I'm writing code? |
@onemanstartup You can use
Replace |
This is awesome! Thanks for sharing! |
This is a really great addition and will really improve the user experience of Spacemacs. I actually might even suggest that this be added by default in new When I switched back to using Spacemacs for work recently the window opening behavior constantly clobbering buffers is a constant annoyance. I remembered talk of Although this may in fact be an effective strategy for getting me to contribute to Spacemacs again. Since I have to use Spacemacs for work, eventually I may get so annoyed at the window opening behavior that if someone tells me what is needed to get this merged, I'll do it myself some weekend. |
I've been using this layer since past 6+ months and without this I find window management out of place. It would be very important addition if we can get this in upcoming 0.200 release. |
<3 On Tue, Sep 20, 2016, 2:30 PM Muneeb Shaikh notifications@github.com
|
This is planned for the next release. It was originally planned for something like 0.104 but each time there were additional stuff stepping in so I had to delay it. |
@trishume welcome back by the way :-D |
- Proper integration with popwin - Integrate with Helm via helm-purpose - Integrate with Ivy via ivy-purpose - Integrate with opening a new eyebrowse workspace - Enable purpose-x-kill: purpose-aware replacement of a window's buffer when a buffer is killed
6d27b7e
to
a24d229
Compare
Updated the PR with |
@bmag this is so lovely. My favourite and long waited PR. Thank you for |
I've been using this layer for a day and I may have found a fairly annoying bug. It seems that the paste transient state confuses window purpose some but not all of the time and replaces the contents of the buffer you are pasting in with the hydra docstring. Yes, the buffer, you have to use |
@trishume I've seen something like this about 1-2 weeks ago, but wasn't sure if it's because of window-purpose or not, and couldn't find out a pattern. Can you reproduce the problem reliably? Does the problem go away if you run |
@bmag I'll try and figure out how to reproduce it reliably and let you know if I do. After I restart my emacs because it's completely hung, as happens near-daily. My return to Spacemacs/emacs has not been going smoothly so far... |
@trishume I figured out how to trigger the bug, I should have a fix today or tomorrow |
@bmag cool. Meanwhile it's started happening to me every time making it really difficult to paste, and |
@trishume turns out Hydra's buffer name changed two weeks ago, so I had to update it in window-purpose as well (the name is hard-coded in Hydra). Fixed it, new version will be available from MELPA in a few hours. |
One of the oldest PR :-D Thank you ! 💯 💜 |
Woooo... it's in! 🎉 🎉 🎉 |
I (and also @nixmaniack) found only one error, and @TheBB already fixed it with #7441. I'll go over my personal config and check if there's something worth adding that wasn't in this PR. |
After using a private layer for two months, I've started working on a proper contrib layer for window-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.
Here is what I've done or planning to do in this PR:
window-purpose
package and define some key bindingswindow-purpose
to give the same behavior aspopwin
, so there's (almost?) no regression in behavior for users. See extensionpurpose-popwin.el
.window-purpose
andpopwin
play together nicely without conflictspurpose-mode-map
, because by default it overrides C-x C-f, C-x b, etc. and conflicts withsemantic
over C-c , key bindings.helm-mini
-like helm command to use instead ofpurpose-switch-buffer-with-purpose
andpurpose-switch-buffer-with-some-purpose
Especially I'd appreciate advice about:
how to write the helm commands - I've had some bugs when I tried, maybe someone else can give it a try?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.Some explanation about
window-purpose
: (no need to read if you're familiar with the package)Basically,
window-purpose
is an alternative to the behavior of stockdisplay-buffer
andswitch-to-buffer
. When stock Emacs chooses a window for a buffer, it can either:The 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.Another 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 purposeedit
(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 REPLwindow or any other type of window I may want - it's all customizable.
What'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.Another short-coming of stock Emacs, IMHO, is that
switch-to-buffer
doesn't follow the rules indisplay-buffer
.window-purpose
enforces its rules also onswitch-to-buffer
. Of course there are still differences betweenswitch-to-buffer
,switch-to-buffer-other-window
,switch-to-buffer-other-frame
,pop-to-buffer
,pop-to-buffer-same-window
anddisplay-buffer
, but now they all use the same mechanism.