aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Weizenbaum <nweiz@google.com>2014-06-06 12:46:50 -0700
committerNathan Weizenbaum <nweiz@google.com>2014-06-06 12:46:50 -0700
commitee3b2079593609a444d2a549f6f8b450141ef573 (patch)
tree61a1d91353bf40156ff55c802b7bbeebf43b4a06
parentecc0a04d22eed30461069e7edfd17c17a0e3c072 (diff)
Clean up the style in persp-set-buffer.
-rw-r--r--perspective.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/perspective.el b/perspective.el
index 887158b..f1ab180 100644
--- a/perspective.el
+++ b/perspective.el
@@ -495,14 +495,17 @@ See also `persp-switch' and `persp-remove-buffer'."
(push buffer (persp-buffers persp-curr)))))
(defun persp-set-buffer (buffer-name)
- "Associate BUFFER-NAME to current perspective and remove it from any other."
+ "Associate BUFFER-NAME with the current perspective and remove it from any other."
+ (interactive
+ (list
+ (let ((read-buffer-function nil))
+ (read-buffer "Set buffer to perspective: "))))
(cond ((get-buffer buffer-name)
(persp-add-buffer buffer-name)
- (while (persp-buffer-in-other-p (get-buffer buffer-name))
- (setq current-perspective persp-curr)
- (persp-switch (cdr (persp-buffer-in-other-p (get-buffer buffer-name))))
- (persp-remove-buffer buffer-name)
- (persp-switch (persp-name current-perspective))))
+ (loop for other-persp = (persp-buffer-in-other-p (get-buffer buffer-name))
+ while other-persp
+ do (with-perspective (cdr other-persp)
+ (persp-remove-buffer buffer-name))))
(t (message "buffer %s doesn't exist" buffer-name))))
(defun* persp-buffer-in-other-p (buffer)