From 5a0912802c8c6d76762c42558c511fcbff17e422 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 7 Sep 2026 21:34:28 +0100 Subject: jao-pdf: circular require fix --- lib/eos/jao-buffers.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/eos/jao-buffers.el') diff --git a/lib/eos/jao-buffers.el b/lib/eos/jao-buffers.el index 5a41486..cae6c0f 100644 --- a/lib/eos/jao-buffers.el +++ b/lib/eos/jao-buffers.el @@ -51,7 +51,23 @@ (add-to-list 'display-buffer-alist (jao-attached-buffer-entry name-rx height))) +;;;###autoload +(defun jao-buffer-same-mode (&optional mode pre-fn switch-fn) + (interactive) + (let* ((mode (or mode major-mode)) + (modes (if (symbolp mode) (list mode) mode)) + (pred `(lambda (b) + (let ((b (get-buffer (if (consp b) (car b) b)))) + (member (buffer-local-value 'major-mode b) + ',modes)))) + (buff (read-buffer "Buffer: " nil t pred))) + (when pre-fn (funcall pre-fn)) + (if switch-fn (funcall switch-fn buff) (switch-to-buffer buff)))) +;;;###autoload +(defun jao-buffer-same-mode-cmd (&optional pop) + (interactive "P") + (jao-buffer-same-mode nil nil (and pop #'pop-to-buffer))) (provide 'jao-buffers) ;;; jao-buffers.el ends here -- cgit v1.2.3