about summary refs log tree commit diff stats
path: root/.emacs.d/lisp
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2024-06-19 11:32:02 +0100
committerDavid Morgan <djm_uk@protonmail.com>2024-06-19 11:32:02 +0100
commitb875074a32fba5bbf19bfbe61fb9e4d06faf44a5 (patch)
tree702920df497ccb6ea01c090f2b4357c144535312 /.emacs.d/lisp
parentb317bdf991d77c34dabc0cf7a34f1dc73039e558 (diff)
downloaddotfiles-b875074a32fba5bbf19bfbe61fb9e4d06faf44a5.tar.gz
Replace crux-switch-to-previous-buffer with a persp-aware version
Diffstat (limited to '.emacs.d/lisp')
-rw-r--r--.emacs.d/lisp/init-crux.el1
-rw-r--r--.emacs.d/lisp/init-project.el6
2 files changed, 6 insertions, 1 deletions
diff --git a/.emacs.d/lisp/init-crux.el b/.emacs.d/lisp/init-crux.el
index fa51ff1..0739bd3 100644
--- a/.emacs.d/lisp/init-crux.el
+++ b/.emacs.d/lisp/init-crux.el
@@ -44,7 +44,6 @@
   ("C-c M-o" . crux-open-with)
   ("C-c C-u" . crux-view-url)
   ("C-c TAB" . crux-indent-rigidly-and-copy-to-clipboard)
-  ("C-c C-M-j" . crux-switch-to-previous-buffer)
   ("C-c C-!" . crux-reopen-as-root))
 
 (provide 'init-crux)
diff --git a/.emacs.d/lisp/init-project.el b/.emacs.d/lisp/init-project.el
index 2229eeb..3e847da 100644
--- a/.emacs.d/lisp/init-project.el
+++ b/.emacs.d/lisp/init-project.el
@@ -102,6 +102,11 @@ mode as the current buffer (or do nothing)."
     "Variant of persp-previous-buffer-same-mode, which opens in other window."
     (interactive)
     (persp-previous-buffer-same-mode #'switch-to-buffer-other-window))
+  ;; Inspired by crux-switch-to-previous-buffer
+  (defun persp-switch-to-previous-buffer ()
+    "Switch to the previous buffer in the current perspective."
+    (interactive)
+    (switch-to-buffer (persp-other-buffer (current-buffer) 1)))
   (defun persp-current-project-root ()
     "Return the current project root, falling back to finding it by the perpsective"
     (if-let (project (project-current))
@@ -131,6 +136,7 @@ mode as the current buffer (or do nothing)."
 
   :bind
   ("C-x p p" . switch-project)
+  ("C-c C-M-j" . persp-switch-to-previous-buffer)
   ("C-x C-b" . persp-previous-buffer-same-mode)
   ("C-x 4 C-b" . persp-previous-buffer-same-mode-other-window)
   ("C-x C-S-b" . persp-switch-buffer-same-mode)