Bad-ptr / persp-mode.el

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

All perspectives gone after restart #134

Open ghost opened 1 year ago

ghost commented 1 year ago

I restarted Emacs and met with this error:

[persp-mode] Error: Can not autoresume perspectives -- (error "Specified root is not an ancestor of specified window")

Now all my perspectives are gone. Please help!

Bad-ptr commented 1 year ago

hmm.... How did this happen? Did it happen after recent update of persp-mode? If not, try to update.

Anyway, looks like the problem with restoring a window configuration. You can try to open a persp-auto-save[n] file in ~/.emacs.d/persp-confs/. See which file contains all needed buffers(search for def-buffer). Then find def-wconf, put cursor on opening bracket >cursor here<(def-wconf,, press Ctrl+Space(start selection), then Ctrl+Alt+f this will select full (def-wconf ...) sexp, replace it with nil. Repeat this for all def-wconfs if needed. After that save file in safe place and load it with Ctrl+c p l (or call persp-load-state-from-file). It will load all your perspectives, only window configurations will be lost.

ghost commented 1 year ago

I will try and restore tomorrow and revert.

Bad-ptr commented 1 year ago

Another workaround to try is to redefine the persp-delete-other-windows(paste this into *scratch*, select, and M-x eval-region):

(defun persp-delete-other-windows ()
  (let ((win (selected-window)))
    (when (or (window-parameter win 'window-side)
              (window-minibuffer-p win))
      (setq win (cl-loop
                 for win in (window-list nil 1)
                 unless (window-parameter win 'window-side)
                 return win)))
    (when win
      (let ((ignore-window-parameters t))
        (condition-case-unless-debug err
            (delete-other-windows win)
          (error
           (message "[persp-mode] Warning: Can not delete-other-windows -- %S" err)))))))

Then try to load perspectives from file.

Bad-ptr commented 1 year ago

redefine the persp-delete-other-windows

It's now in master fc129b7d89eee58eefddac0cad11f639de84a812