summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2024-02-11 14:26:07 +0800
committerJSDurand <mmemmew@gmail.com>2024-02-11 14:26:07 +0800
commite8756c4f4b75bb9a39cb4c9906da35d40d347b86 (patch)
treed93e486b696b00c241118513eb96d661d0876be0
parentb02e23f59e69f92366d546a770177b5127781235 (diff)
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.
-rw-r--r--tab-conf.el27
1 files changed, 23 insertions, 4 deletions
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)))