From bceca4ce0fc41de407a293b5d52d723bc687f359 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Tue, 6 Jan 2026 21:34:37 -0800 Subject: [PATCH] Using Unicode characters for the tab-bar mode --- ha-config.org | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/ha-config.org b/ha-config.org index 2aa51a8..5f08af0 100644 --- a/ha-config.org +++ b/ha-config.org @@ -1118,6 +1118,48 @@ Any time I create or delete a new tab, we can call =ha-tab-bar-update-names=: (add-hook desktop-after-read-hook #'ha-tab-bar-update-names) #+END_SRC +*** Add Numbers ot Tab Bar Mode +Christian Tietze had a [[https://christiantietze.de/posts/2022/02/emacs-tab-bar-numbered-tabs/][great idea]] for making the tab-bar numbers more distinguished from the labels on the tabs (he has a [[https://christiantietze.de/posts/2022/12/sf-symbols-emacs-tab-numbers/][follow up essay]] about using a different font, Unicode is more portable and looks fine). + +First, create a variable that contains the Unicode values for the numbers. I am using the negative versions of the circle numbers from the Unicode dingbats collection: + +#+BEGIN_SRC emacs-lisp + (defvar ha/circle-numbers-alist + '((0 . "πŸ„Œ") + (1 . "➊") + (2 . "βž‹") + (3 . "➌") + (4 . "➍") + (5 . "➎") + (6 . "➏") + (7 . "➐") + (8 . "βž‘") + (9 . "βž’")) + "Alist of integers to strings of circled unicode numbers.") +#+END_SRC + +And then use this function to replace the standard =tab-bar-tab-name-format-function=: + +#+BEGIN_SRC emacs-lisp + (defun ha/tab-bar-tab-name-format-default (tab i) + (let ((current-p (eq (car tab) 'current-tab)) + (tab-num (if (and tab-bar-tab-hints (< i 10)) + (alist-get i ha/circle-numbers-alist) ""))) + (propertize + (concat tab-num + " " + (alist-get 'name tab) + (or (and tab-bar-close-button-show + (not (eq tab-bar-close-button-show + (if current-p 'non-selected 'selected))) + tab-bar-close-button) + "") + " ") + 'face (funcall tab-bar-tab-face-function tab)))) + + (setq tab-bar-tab-name-format-function + #'ha/tab-bar-tab-name-format-default) +#+END_SRC * Pretty Good Encryption For details on using GnuPG in Emacs, see Mickey Petersen’s [[https://www.masteringemacs.org/article/keeping-secrets-in-emacs-gnupg-auth-sources][GnuPG Essay]].