aboutsummaryrefslogtreecommitdiff
path: root/perspective.el
diff options
context:
space:
mode:
authorConstantine Vetoshev <gepardcv@gmail.com>2020-05-12 13:53:08 -0700
committerConstantine Vetoshev <gepardcv@gmail.com>2020-05-12 13:53:08 -0700
commit4a81843395122f9d946611ba68598f27c3ed9923 (patch)
tree7e58ae5c262f22b467aafa885d0d14af8b4aece8 /perspective.el
parent4998c1184dba3e9e18e2f3d9153a4a03797c1940 (diff)
Fix up commit 4998c118: pull the scratch buffer into perspective.
Diffstat (limited to 'perspective.el')
-rw-r--r--perspective.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/perspective.el b/perspective.el
index 914a00b..3ab4af2 100644
--- a/perspective.el
+++ b/perspective.el
@@ -808,11 +808,15 @@ perspective and no others are killed."
(let* ((old-scratch-name (persp-scratch-buffer))
(new-scratch-name (persp-scratch-buffer name))
(scratch-buffer (get-buffer old-scratch-name)))
- (when (and scratch-buffer
- ;; https://github.com/nex3/perspective-el/issues/128
- (not (get-buffer new-scratch-name)))
- (with-current-buffer scratch-buffer
- (rename-buffer new-scratch-name))))
+ (when scratch-buffer
+ (if (get-buffer new-scratch-name)
+ ;; https://github.com/nex3/perspective-el/issues/128
+ ;; Buffer already exists, probably on another frame. Pull it into
+ ;; the current perspective; they'll be shared.
+ (persp-add-buffer new-scratch-name)
+ ;; Buffer with new-scratch-name does not exist, so just rename it.
+ (with-current-buffer scratch-buffer
+ (rename-buffer new-scratch-name)))))
;; rewire the rest of the perspective inside its data structures
(remhash (persp-current-name) (perspectives-hash))
(puthash name (persp-curr) (perspectives-hash))