Bad-ptr / persp-mode.el

named perspectives(set of buffers/window configs) for emacs
394 stars 44 forks source link

conflict with writeroom-mode #114

Closed tshu-w closed 4 years ago

tshu-w commented 4 years ago

If I enable writeroom-mode, split window, switch to another persp, and switch back. the persp-mode cannot load this perspective correctly.

before:

Screen Shot 2020-03-09 at 9 34 52 AM

after swich back:

Screen Shot 2020-03-09 at 9 35 07 AM
Debugger entered--Lisp error: (wrong-type-argument window-valid-p nil)
  set-window-combination-limit(nil t)
  window--state-put-2(t 718)
  window-state-put((((min-height . 4) (min-width . 20) (min-height-ignore . 3) (min-width-ignore . 8) (min-height-safe . 1) (min-width-safe . 4) (min-pixel-height . 72) (min-pixel-width . 160) (min-pixel-height-ignore . 54) (min-pixel-width-ignore . 64) (min-pixel-height-safe . 18) (min-pixel-width-safe . 32)) hc (pixel-width . 1268) (pixel-height . 718) (total-width . 158) (total-height . 39) (normal-height . 1.0) (normal-width . 1.0) (combination-limit . t) (leaf (pixel-width . 636) (pixel-height . 718) (total-width . 79) (total-height . 39) (normal-height . 1.0) (normal-width . 0.501577287066246) (buffer "gtd.org" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 0 t nil 0 t) (vscroll . 0) (dedicated) (point . 23434) (start . 1))) (leaf (last . t) (pixel-width . 632) (pixel-height . 718) (total-width . 79) (total-height . 39) (normal-height . 1.0) (normal-width . 0.49842271293375395) (buffer "gtd.org" (selected) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 0 t nil 0 t) (vscroll . 0) (dedicated) (point . 23434) (start . 1)))) #<window 3 on gtd.org> t)
  (progn (window-state-put pwc rwin t))
  (if (fboundp (quote window-state-put)) (progn (window-state-put pwc rwin t)))
  (when (fboundp (quote window-state-put)) (window-state-put pwc rwin t))
  (progn (when (fboundp (quote window-state-put)) (window-state-put pwc rwin t)))
  (if (or rwin (setq rwin (frame-root-window (or frame (selected-frame))))) (progn (when (fboundp (quote window-state-put)) (window-state-put pwc rwin t))))
  (when (or rwin (setq rwin (frame-root-window (or frame (selected-frame))))) (when (fboundp (quote window-state-put)) (window-state-put pwc rwin t)))
  (lambda (pwc &optional frame rwin) (when (or rwin (setq rwin (frame-root-window (or frame (selected-frame))))) (when (fboundp (quote window-state-put)) (window-state-put pwc rwin t))))((((min-height . 4) (min-width . 20) (min-height-ignore . 3) (min-width-ignore . 8) (min-height-safe . 1) (min-width-safe . 4) (min-pixel-height . 72) (min-pixel-width . 160) (min-pixel-height-ignore . 54) (min-pixel-width-ignore . 64) (min-pixel-height-safe . 18) (min-pixel-width-safe . 32)) hc (pixel-width . 1268) (pixel-height . 718) (total-width . 158) (total-height . 39) (normal-height . 1.0) (normal-width . 1.0) (combination-limit . t) (leaf (pixel-width . 636) (pixel-height . 718) (total-width . 79) (total-height . 39) (normal-height . 1.0) (normal-width . 0.501577287066246) (buffer "gtd.org" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 0 t nil 0 t) (vscroll . 0) (dedicated) (point . 23434) (start . 1))) (leaf (last . t) (pixel-width . 632) (pixel-height . 718) (total-width . 79) (total-height . 39) (normal-height . 1.0) (normal-width . 0.49842271293375395) (buffer "gtd.org" (selected) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 0 t nil 0 t) (vscroll . 0) (dedicated) (point . 23434) (start . 1)))) #<frame Emacs@Tshus-MacBook-Pro.local 0x102a2f438>)
  persp-restore-window-conf(#<frame Emacs@Tshus-MacBook-Pro.local 0x102a2f438> nil nil)
  #f(compiled-function (persp &rest --cl-rest--) #<bytecode 0x43b2f53d>)(nil #<frame Emacs@Tshus-MacBook-Pro.local 0x102a2f438>)
  apply(#f(compiled-function (persp &rest --cl-rest--) #<bytecode 0x43b2f53d>) (nil #<frame Emacs@Tshus-MacBook-Pro.local 0x102a2f438>))
  persp-activate(nil #<frame Emacs@Tshus-MacBook-Pro.local 0x102a2f438>)
  persp-frame-switch("Default" #<frame Emacs@Tshus-MacBook-Pro.local 0x102a2f438>)
  #f(compiled-function (name &optional frame &rest --cl-rest--) "Switch to the perspective with name `NAME'.\nIf there is no perspective with that name it will be created.\nReturn `NAME'." (interactive "i") #<bytecode 0x4394e2e9>)("Default")
  apply(#f(compiled-function (name &optional frame &rest --cl-rest--) "Switch to the perspective with name `NAME'.\nIf there is no perspective with that name it will be created.\nReturn `NAME'." (interactive "i") #<bytecode 0x4394e2e9>) "Default")
  persp-switch("Default")
  (if persp-to-switch (persp-switch persp-to-switch) (persp-switch nil))
  (let ((persp-to-switch (nth pos (persp-names-current-frame-fast-ordered)))) (if persp-to-switch (persp-switch persp-to-switch) (persp-switch nil)))
  switch-persp-by-pos(0)
  switch-to-persp-1()
  funcall-interactively(switch-to-persp-1)
  call-interactively(switch-to-persp-1 nil nil)
  command-execute(switch-to-persp-1)

If you need more info, please tell me.

joostkremers commented 4 years ago

Hi, I'm the maintainer of writeroom-mode. I just noticed issue #110, which indicates there's also a conflict with another package of mine, visual-fill-column-mode. Since the problem description seems similar and because visual-fill-column-mode is used by writeroom-mode to set the margins, the two issues may well be related.

The backtrace posted by @tshu-w doesn't point to any code from writeroom-mode or visual-fill-column-mode, so I can't really help interpreting it. But if it turns out that either of my packages does something weird that trips up persp-mode, I'd be happy to help and figure out how it should be fixed.

tshu-w commented 4 years ago

it’s not issue(caused by writeroom-maximize-window t). @joostkremers BTW, thank you for your enthusiastic help.