From 4236a39dfb897c26edfde061f79ea4b397780df7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 17 Jan 2022 17:13:10 -0600 Subject: Add unworking sketch for fluid-width tabs --- lisp/+tab-bar.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'lisp') diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index ffbdd70..2e9198c 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -37,6 +37,52 @@ (file-name-nondirectory tab-file-name) (+tab-bar-tab-name-truncated-left))))) +;;; FIXME this doesn't work... +;; (defvar +tab-bar-tab-min-width 8 +;; "Minimum width of a tab on the tab bar.") + +;; (defvar +tab-bar-tab-max-width 24 +;; "Maximum width of a tab on the tab bar.") + +;; (defun +tab-bar-fluid-calculate-width () +;; "Calculate the width of each tab in the tab-bar." +;; (let* ((tab-bar-list (cdr (tab-bar-make-keymap-1))) +;; (tab-bar-avail-width (frame-width)) +;; (tab-bar-tab-count (length (tab-bar-tabs))) +;; (tab-bar-close-button-char-width 1) +;; (tab-bar-add-tab-button-char-width 1) +;; (tab-bar-total-width +;; (length (mapconcat +;; (lambda (el) +;; (when-let ((str (car-safe (cdr-safe (cdr-safe el))))) +;; (substring-no-properties (eval str)))) +;; tab-bar-list))) +;; (tab-bar-total-tab-width +;; (+ (* tab-bar-tab-count tab-bar-close-button-char-width) +;; tab-bar-add-tab-button-char-width +;; (length (mapconcat +;; (lambda (el) +;; (substring-no-properties (alist-get 'name el))) +;; (tab-bar-tabs))))) +;; (tab-bar-total-nontab-width (- tab-bar-total-width +;; tab-bar-total-tab-width))) +;; (min +tab-bar-tab-max-width +;; (max +tab-bar-tab-min-width +;; (/ (- tab-bar-avail-width +;; tab-bar-total-tab-width +;; tab-bar-total-nontab-width) +;; tab-bar-tab-count))))) + +;; (defun +tab-bar-fluid-width () +;; "Generate the tab name to fluidly fit in the given space." +;; (let* ((tab-file-name (buffer-file-name (window-buffer +;; (minibuffer-selected-window))))) +;; (format (format " %%s%%%ds" (+tab-bar-fluid-calculate-width)) +;; (if tab-file-name +;; (file-name-nondirectory tab-file-name) +;; (+tab-bar-tab-name-truncated-left)) +;; " "))) + (defun +tab-bar-tab-name-truncated-left () "Generate the tab name from the buffer of the selected window. This is just like `tab-bar-tab-name-truncated', but truncates the -- cgit 1.4.1-21-gabe81