From e8756c4f4b75bb9a39cb4c9906da35d40d347b86 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 11 Feb 2024 14:26:07 +0800 Subject: tab-conf: Add a command to help inspect tabs. * tab-conf.el (tab-prefix-map): Bind it to 'c' in the prefix map. (durand-tab-list): Count the tabs and list them all. --- tab-conf.el | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'tab-conf.el') diff --git a/tab-conf.el b/tab-conf.el index de04d73..6062abc 100644 --- a/tab-conf.el +++ b/tab-conf.el @@ -4,9 +4,10 @@ (setq tab-bar-format nil) -(define-key tab-switcher-mode-map (vector ?n) 'tab-switcher-next-or-first) -(define-key tab-switcher-mode-map (vector ?p) 'tab-switcher-prev-or-last) -(define-key tab-prefix-map (vector 'tab) 'tab-switcher) +(define-key tab-switcher-mode-map (vector ?n) #'tab-switcher-next-or-first) +(define-key tab-switcher-mode-map (vector ?p) #'tab-switcher-prev-or-last) +(define-key tab-prefix-map (vector 'tab) #'tab-switcher) +(define-key tab-prefix-map (vector ?c) #'durand-tab-list) (define-key global-map (vector ?\s-t) #'durand-switch-tab-dwim) (define-key global-map (vector ?\s-T) #'tab-switcher) @@ -130,5 +131,23 @@ then go to the last configuration line." (t (skip-chars-forward "[:space:]") (forward-char -1)))) - +(defun durand-tab-list () + "List all tabs in the echo area." + (interactive) + (let* ((tabs (tab-bar-tabs)) + (str (mapconcat + (lambda (tab) + (propertize + (cdr (assoc 'name (cdr tab))) + 'face + (cond ((eq (car tab) 'current-tab) + 'success) + ('default)))) + tabs + " | "))) + (message "%d tab%s: %s" + (length tabs) + (cond ((> (length tabs) 1) "s") + ("")) + str))) -- cgit v1.2.3-18-g5258