From 13fb1ddcbe0c10f1678604f4b98f32e0ebd0f343 Mon Sep 17 00:00:00 2001 From: Constantine Vetoshev Date: Tue, 11 Aug 2020 22:48:18 -0700 Subject: Work around a crash when closing a frame created by emacsclient. --- perspective.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/perspective.el b/perspective.el index 104fbf2..5bcdd60 100644 --- a/perspective.el +++ b/perspective.el @@ -1049,7 +1049,16 @@ By default, this uses the current frame." "Clean up perspectives in FRAME. By default this uses the current frame." (with-selected-frame frame - (mapcar #'persp-kill (persp-names)))) + ;; XXX: Only clean up frame perspectives when frame was _not_ created with + ;; emacsclient. Attempting this cleanup causes crashes for unclear reasons. + ;; Investigation shows that persp-delete-frame gets called multiple times in + ;; unexpected ways. To reproduce: (1) get a session going with a main frame, + ;; (2) use emacsclient -c to edit a file in a new frame, (3) C-x 5 0 to kill + ;; that frame. + ;; TODO: Try to fix this, since emacsclient -c use with perspective can + ;; leave dangling buffers unassociated with any perspective. + (unless (frame-parameter frame 'client) + (mapcar #'persp-kill (persp-names))))) (defun persp-make-variable-persp-local (variable) "Make VARIABLE become perspective-local. -- cgit v1.0