From b875074a32fba5bbf19bfbe61fb9e4d06faf44a5 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Wed, 19 Jun 2024 11:32:02 +0100 Subject: Replace crux-switch-to-previous-buffer with a persp-aware version --- .emacs.d/lisp/init-crux.el | 1 - .emacs.d/lisp/init-project.el | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to '.emacs.d/lisp') 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) -- cgit 1.4.1-2-gfad0