aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantine Vetoshev <gepardcv@gmail.com>2020-08-11 22:48:18 -0700
committerConstantine Vetoshev <gepardcv@gmail.com>2020-08-11 22:48:18 -0700
commit13fb1ddcbe0c10f1678604f4b98f32e0ebd0f343 (patch)
tree08c418180391bf5bbb268356928ffe9962d8296d
parent4acf342ba5547412da716506e7ca5f7edc43b1f4 (diff)
Work around a crash when closing a frame created by emacsclient.
-rw-r--r--perspective.el11
1 files changed, 10 insertions, 1 deletions
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.