summaryrefslogtreecommitdiffhomepage
path: root/lib/eos/jao-buffers.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2026-09-06 15:36:38 +0100
committerjao <jao@gnu.org>2026-09-06 15:36:38 +0100
commit0f8eb65fb807a125dd601cd6b3ee746e6c7b6020 (patch)
tree1d394cf0023d0d4e9df41a28c1d4376769c91d77 /lib/eos/jao-buffers.el
parent21c34f24c110e57a6c90126c87fee9cd71e85817 (diff)
downloadelibs-0f8eb65fb807a125dd601cd6b3ee746e6c7b6020.tar.gz
elibs-0f8eb65fb807a125dd601cd6b3ee746e6c7b6020.tar.bz2
a slew of little fixes courtesy of the byte compiler
Diffstat (limited to 'lib/eos/jao-buffers.el')
-rw-r--r--lib/eos/jao-buffers.el57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/eos/jao-buffers.el b/lib/eos/jao-buffers.el
new file mode 100644
index 0000000..5a41486
--- /dev/null
+++ b/lib/eos/jao-buffers.el
@@ -0,0 +1,57 @@
+;;; jao-buffers.el --- utilities to deal with buffers and windows -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Jose Antonio Ortega Ruiz
+
+;; Author: Jose Antonio Ortega Ruiz <mail@jao.io>
+;; Keywords: files
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+;;;; attached buffers
+(defun jao-display-buffer-below-selected (buffer alist)
+ (delete-other-windows-vertically)
+ (display-buffer-below-selected buffer alist))
+
+(defun jao-display-below-eldoc (buffer alist)
+ (let ((w (selected-window)))
+ (pop-to-buffer "*eldoc*" nil t)
+ (jao-display-buffer-below-selected buffer alist)
+ (select-window w t)))
+
+(defun jao-attached-buffer-entry (name-rx height)
+ `(,name-rx (display-buffer-reuse-window
+ jao-display-buffer-below-selected)
+ (window-height . ,(or height 25))))
+
+;;;###autoload
+(defmacro jao-with-attached-buffer (name-rx height &rest body)
+ (declare (indent defun))
+ `(let ((display-buffer-alist '(,(jao-attached-buffer-entry name-rx height))))
+ ,@body))
+
+;;;###autoload
+(defun jao-define-attached-buffer (name-rx &optional height)
+ (add-to-list 'display-buffer-alist
+ (jao-attached-buffer-entry name-rx height)))
+
+
+
+(provide 'jao-buffers)
+;;; jao-buffers.el ends here