aboutsummaryrefslogtreecommitdiff
path: root/perspective.el
diff options
context:
space:
mode:
authorMatthew White <mehw.is.me@inventati.org>2021-06-24 18:03:32 +0000
committerMatthew White <mehw.is.me@inventati.org>2021-10-21 01:27:37 +0200
commita6d5feb11625aed9eb171727da7ff4c89ed89f22 (patch)
tree739e27c098e6d0a1120fa897da10b4745be01fa2 /perspective.el
parentb5202b1a163e931708346ed898012736b9c4e675 (diff)
persp-switch-to-scratch-buffer: switch to the scratch buffer
Utility function to switch to the current perspective's scratch buffer, or to create one if it does not exist yet. Add binding "C-x x B" to call 'persp-switch-to-scratch-buffer'.
Diffstat (limited to 'perspective.el')
-rw-r--r--perspective.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/perspective.el b/perspective.el
index 0b27c7e..2939281 100644
--- a/perspective.el
+++ b/perspective.el
@@ -233,6 +233,12 @@ Create it if the current perspective doesn't have one yet."
(set-buffer-modified-p nil))))
scratch-buffer))
+(defun persp-switch-to-scratch-buffer ()
+ "Switch to the current perspective's scratch buffer.
+Create the scratch buffer if there isn't one yet."
+ (interactive)
+ (switch-to-buffer (persp-get-scratch-buffer)))
+
(defalias 'persp-killed-p 'persp-killed
"Return whether the perspective CL-X has been killed.")
@@ -308,6 +314,7 @@ Run with the activated perspective active.")
(define-key perspective-map (kbd "a") 'persp-add-buffer)
(define-key perspective-map (kbd "A") 'persp-set-buffer)
(define-key perspective-map (kbd "b") 'persp-switch-to-buffer)
+(define-key perspective-map (kbd "B") 'persp-switch-to-scratch-buffer)
(define-key perspective-map (kbd "i") 'persp-import)
(define-key perspective-map (kbd "n") 'persp-next)
(define-key perspective-map (kbd "<right>") 'persp-next)