aboutsummaryrefslogtreecommitdiff
path: root/perspective.el
diff options
context:
space:
mode:
authorNatalie Weizenbaum <nweiz@google.com>2015-05-08 15:53:03 -0700
committerNatalie Weizenbaum <nweiz@google.com>2015-05-08 15:53:03 -0700
commitcfcd5a4cb016a1425ae4d20a9286578666d9a1b9 (patch)
treef7abc8b27ddcd49302c27052349c446067908285 /perspective.el
parent0084f47066f0f20d2ad6045446ac04f5526ccd29 (diff)
parentb22ab1a6ff6ee8fb65bb5a0a77c6380bd0a5fb04 (diff)
Merge branch 'redshirtrob.master'
Diffstat (limited to 'perspective.el')
-rw-r--r--perspective.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/perspective.el b/perspective.el
index 18a1f85..a5bd4f1 100644
--- a/perspective.el
+++ b/perspective.el
@@ -78,6 +78,11 @@ perspectives."
(set-default sym value))
:type 'key-sequence)
+(defcustom persp-switch-wrap t
+ "Whether `persp-next' and `persp-prev' should wrap."
+ :group 'perspective-mode
+ :type 'boolean)
+
;; This is only available in Emacs >23,
;; so we redefine it here for compatibility.
(unless (fboundp 'with-selected-frame)
@@ -485,7 +490,8 @@ See `persp-switch', `persp-get-quick'."
(pos (cl-position (persp-name persp-curr) names)))
(cond
((null pos) (persp-find-some))
- ((= pos (1- (length names))))
+ ((= pos (1- (length names)))
+ (if persp-switch-wrap (persp-switch (nth 0 names))))
(t (persp-switch (nth (1+ pos) names))))))
(defun persp-prev ()
@@ -495,7 +501,8 @@ See `persp-switch', `persp-get-quick'."
(pos (cl-position (persp-name persp-curr) names)))
(cond
((null pos) (persp-find-some))
- ((= pos 0))
+ ((= pos 0)
+ (if persp-switch-wrap (persp-switch (nth (1- (length names)) names))))
(t (persp-switch (nth (1- pos) names))))))
(defun persp-find-some ()