wasamasa / eyebrowse

A simple-minded way of managing window configs in emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

golden-ratio-mode breaks eyebrowse when using multiple windows

topher200 opened this issue Β· comments

Description :octocat:

Creating or moving to a eyebrowse workspace with a complex window arrangement while in golden-ratio-mode results in error.

Turning off golden-ratio-mode removes the error.

Observed on Spacemacs' master and develop.

Reproduction guide πŸͺ²

  • Start Emacs
  • C-x b sc Enter Navigate to *scratch* buffer
  • Space t g Turn on golden-ratio-mode
  • Space w v Split the window vertically
  • Space w h Split the window horizontally
  • Space w v Split the window vertically one more time
  • βœ… There should be four windows
  • C-c C-w C-c Attempt to create a new workspace

Observed behaviour: πŸ‘€ πŸ’”
The new workspace is created!

However, we stay in our original workspace. One of the windows has disappeared from our original workspace; we now have three windows.

This error appears in the status bar:
window--state-put-1: Cannot resize window #<window 3 on *temp*>

Expected behaviour: ❀️ πŸ˜„
The new workspace is created. We move to the new workspace. Our original workspace is unmodified.

System Info πŸ’»

  • OS: darwin
  • Emacs: 25.1.1
  • Spacemacs: 0.200.5
  • Spacemacs branch: develop (rev. fea919c)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(sql auto-completion emacs-lisp
     (evil-snipe :variables evil-snipe-enable-alternate-f-and-t-behaviors t)
     (git :variables git-gutter-use-fringe t)
     go helm html javascript markdown python shell
     (syntax-checking :variables syntax-checking-enable-tooltips nil)
     topher yaml)
  • System configuration features: JPEG RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

I'm sorry, but could you please provide a repro not involving your Emacs configuration, that is, Spacemacs?

Steps to reproduce without Spacemacs:

  1. Clear out your emacs configuration by deleting or moving your .emacs.d/
  2. Start Emacs
  3. Enable Marmalade repo (https://marmalade-repo.org/#download)
  4. Install eyebrowse using install-package
  5. Install el-get (https://github.com/dimitri/el-get)
  6. Install golden-ratio-mode using el-get-install golden-ratio-mode
  7. M-x eyebrowse-mode Turn on eyebrowse mode
  8. M-x golden-ratio-mode Turn on golden-ratio mode
  9. C-x 3 Split window on the right
  10. C-x 2 Split window on the bottom
  11. C-x 3 Split window on the right
  12. βœ… There should be four windows
  13. M-x eyebrowse-create-window-config Create a new workspace using eyebrowse

Observe this error in Messages:
window--state-put-1: Cannot resize window #<window 20 on *temp*>

This should also work by installing everything from MELPA, right?

I would assume so! I've had no issues reproducing the issue no matter how the pieces were installed.

Hmm, I can switch window configurations, but get different errors in a minimal session. Can you enable backtraces with M-x toggle-debug-on-error and include yours?

I tried, but no backtrace appears in Backtrace.

I'm going to modify the steps a bit by adding a step 8B, just so that we start with the exact same window configuration.

  1. Clear out your emacs configuration by deleting or moving your .emacs.d/
  2. Start Emacs
  3. Enable Marmalade repo (https://marmalade-repo.org/#download)
  4. Install eyebrowse using install-package
  5. Install el-get (https://github.com/dimitri/el-get)
  6. Install golden-ratio-mode using el-get-install golden-ratio-mode
  7. M-x eyebrowse-mode Turn on eyebrowse mode
  8. M-x golden-ratio-mode Turn on golden-ratio mode
    • Step 8B: Close all windows but one, using C-x 0. Load your *scratch* buffer the one remaining window
  9. C-x 3 Split window on the right
  10. C-x 2 Split window on the bottom
  11. C-x 3 Split window on the right
  12. βœ… There should be four windows
  13. M-x eyebrowse-create-window-config Create a new workspace using eyebrowse

Here's what I get in Messages with that configuration:

Debug on Error enabled globally
window--state-put-1: Cannot resize window #<window 56 on  *temp*>

Notice that Messages says that I've enabled debug-on-error, but there is no Backtrace buffer.

@wasamasa If it would be helpful to do some kind of screenshare to debug the issue together I'd be happy to assist.

OK, can reproduce that one now. I have a partial fix that defers the error to happen a bit later. From what I can tell, golden-ratio does really weird things. One part is advicing/hooking nilly-willy, the other part is resizing windows shortly after the user performed a command (which is too late for packages to notice)

I have the other "fix". If you remove the part of golden-ratio-mode that adds itself to window-configuration-change-hook, the error is no more. Therefore I consider this to be a golden-ratio issue. Still, thanks for pointing this one out as I've made eyebrowse a bit more robust after the suggestion!

In case anyone else is having this problem, this pull request seems to solve the problem for me: roman/golden-ratio.el#66

I have only tested in two workspaces that I am using right now so far, so caveat emptor.

Same problem here.

@ChrisSalisbury no. if you open more than 2 windows the problem still occurred.

Steps:

  1. open eyebrowse workspace 1, 2 and 3
  2. open 1 window in w1, 3 windows in w2 and 3 windows in w3.
  3. try to switch workspace. The order of buffer will messed up and the error occurred again. (the error doesn't happen in w1 because it's only contain 1 window)
window--state-put-1: Cannot resize window #<window 69 on  *temp*>
window--state-put-1: Cannot resize window #<window 78 on  *temp*>
commented

Hi, I profiled CPU usage when invoking golden-ratio, and I got results below that it seems like that eyebrowse-format-slot in eyebrowse-mode-line-indicator calls the golden-ratio functions.

I don't know if this can help but i hope.

image

Please don't hijack existing threads for unrelated problems. Besides, I fail seeing what the problem is. All the profiler log shows here is that when windows are resized, both the eyebrowse indicator is recalculated and golden-ratio resizing is triggered as well. If you have an issue with golden-ratio triggering too often, complain on their bug tracker, not here.

commented

Sorry for that. Will issue one there. I can delete this one if it is needed.

Yep, not fixed!