diff options
| author | jao <jao@gnu.org> | 2026-09-07 21:34:28 +0100 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2026-09-07 21:37:46 +0100 |
| commit | 5a0912802c8c6d76762c42558c511fcbff17e422 (patch) | |
| tree | 0014575ac5d41f2273123bee7e648c35d4c17a68 /lib/eos/jao-buffers.el | |
| parent | 45c15fdd38c0b9dde8099813137b2ebdea3ca3bc (diff) | |
| download | elibs-5a0912802c8c6d76762c42558c511fcbff17e422.tar.gz elibs-5a0912802c8c6d76762c42558c511fcbff17e422.tar.bz2 | |
jao-pdf: circular require fix
Diffstat (limited to 'lib/eos/jao-buffers.el')
| -rw-r--r-- | lib/eos/jao-buffers.el | 16 |
1 files changed, 16 insertions, 0 deletions
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 |
