summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-05 15:35:42 +0100
committerjao <jao@gnu.org>2022-09-05 15:35:42 +0100
commit6dfdbc7d9159e6058f8a3848e27ed187a0da7a45 (patch)
tree19b292f99986c34829d1779be1f2e93cd7bfc92a
parentff6d46eb611b82ea48746ba4bdf9a563298ac519 (diff)
downloadelibs-6dfdbc7d9159e6058f8a3848e27ed187a0da7a45.tar.gz
elibs-6dfdbc7d9159e6058f8a3848e27ed187a0da7a45.tar.bz2
better jao-buffer-same-mode interactivity
-rw-r--r--custom/jao-custom-completion.el1
-rw-r--r--init.el11
2 files changed, 8 insertions, 4 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el
index 5026a44..089da6b 100644
--- a/custom/jao-custom-completion.el
+++ b/custom/jao-custom-completion.el
@@ -218,7 +218,6 @@
:ensure t
:bind (("C-x M-:" . consult-complex-command)
("C-x b" . consult-buffer)
- ("C-x C-b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-c b" . project-find-file)
("C-c h" . nil)
diff --git a/init.el b/init.el
index b6c0765..bc67e0b 100644
--- a/init.el
+++ b/init.el
@@ -1185,7 +1185,7 @@
;;;; same mode
(defun jao-buffer-same-mode (&optional mode pre-fn switch-fn)
- (interactive "P")
+ (interactive)
(let* ((mode (or mode major-mode))
(modes (if (symbolp mode) (list mode) mode))
(pred `(lambda (b)
@@ -1194,8 +1194,13 @@
',modes))))
(buff (read-buffer "Buffer: " nil t pred)))
(when pre-fn (funcall pre-fn))
- (if switch-fn (funcall switch-fn buff) (pop-to-buffer buff))))
-(global-set-key (kbd "C-c C-b") #'jao-buffer-same-mode)
+ (if switch-fn (funcall switch-fn buff) (switch-to-buffer buff))))
+
+(defun jao-buffer-same-mode-cmd (&optional pop)
+ (interactive "P")
+ (jao-buffer-same-mode nil nil (and pop #'pop-to-buffer)))
+
+(global-set-key (kbd "C-x C-b") #'jao-buffer-same-mode-cmd)
;;;; projects
(use-package project :demand t)