diff options
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 |
