Bad-ptr / persp-mode.el

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

"Cannot make side window the only window" on persp-restore-window-conf #90

Closed hlissner closed 6 years ago

hlissner commented 6 years ago

If the current window is a side window, and you attempt to switch perspectives (via persp-switch), the following error occurs: Cannot make side window the only window, leaving persp-mode in a broken state.

Steps to reproduce

  1. Opens Emacs 26+
  2. Create a new perspective: (persp-add-new "X") (don't switch to it)
  3. Create and select the side window:
    (let* ((buffer (get-buffer-create "*temp*"))
         (window (display-buffer-in-side-window buffer '((side . bottom)))))
    (select-window window))
  4. Switch to the "X" workspace via M-x persp-switch.

I'm not sure how you want to handle this edge case. The workaround I am currently using is:

  (defun select-non-side-window (&rest _)
    "Ensure a side window isn't current when switching workspaces."
    (when (window-parameter nil 'window-side)
      (select-window
       (cl-loop for win in (window-list)
                unless (window-parameter win 'window-side)
                return win))))
  (add-hook 'persp-before-deactivate-functions #'select-non-side-window)
Bad-ptr commented 6 years ago

Thanks for detailed bug report. Can you test the develop branch fea610580fc748125dd431d9173cded14394f9b1 ?

hlissner commented 6 years ago

Sorry for the late reply. fea6105 has been working without issue!

Bad-ptr commented 6 years ago

ok, then it must be fixed