From 1c955d0f85f2ee7e9d89f548bb286ad3ba6f3461 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Thu, 5 Sep 2024 13:36:47 +0100 Subject: Add iflipb-kill-current-buffer and swap bindings --- .emacs.d/lisp/init-ui.el | 2 +- .emacs.d/lisp/init-windows.el | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to '.emacs.d') diff --git a/.emacs.d/lisp/init-ui.el b/.emacs.d/lisp/init-ui.el index 0c12934..cb1c831 100644 --- a/.emacs.d/lisp/init-ui.el +++ b/.emacs.d/lisp/init-ui.el @@ -16,7 +16,7 @@ (global-display-line-numbers-mode) (global-hl-line-mode +1) - (global-set-key (kbd "C-x C-S-k") 'kill-this-buffer) + (global-set-key (kbd "C-x C-S-k") 'kill-buffer) (add-to-list 'custom-theme-load-path "~/.emacs.d/themes") (load-theme 'non-modo t))) diff --git a/.emacs.d/lisp/init-windows.el b/.emacs.d/lisp/init-windows.el index be6d902..fcf39cc 100644 --- a/.emacs.d/lisp/init-windows.el +++ b/.emacs.d/lisp/init-windows.el @@ -205,9 +205,21 @@ This is based on the frame width, with the threshold being customised using "Abort buffer flipping and return to the original buffer." (interactive) (iflipb-restore-buffers)) + (defun iflipb-kill-current-buffer () + "Same as `kill-current-buffer' but keep the iflipb buffer list state. + +Modified from `iflipb-kill-buffer'." + (interactive) + (call-interactively #'kill-current-buffer) + (if (iflipb-first-iflipb-buffer-switch-command) + (setq last-command 'kill-current-buffer) + (if (< iflipb-current-buffer-index (length (iflipb-interesting-buffers))) + (iflipb-select-buffer iflipb-current-buffer-index) + (iflipb-select-buffer (1- iflipb-current-buffer-index))) + (setq last-command 'iflipb-kill-current-buffer))) :custom (iflipb-buffer-list-function 'iflipb-persp-buffer-list) :bind - ("C-x k" . iflipb-kill-buffer) ;; TODO replace with a kill currently selected buffer command + ("C-x k" . iflipb-kill-current-buffer) ("" . iflipb-previous-buffer) ("" . iflipb-next-buffer) ("" . iflibp-abort)) -- cgit 1.4.1-2-gfad0