emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/marginalia 37f26dbf59: Improve marginalia-annotate-tab


From: ELPA Syncer
Subject: [elpa] externals/marginalia 37f26dbf59: Improve marginalia-annotate-tab
Date: Tue, 15 Feb 2022 04:57:35 -0500 (EST)

branch: externals/marginalia
commit 37f26dbf59938086b1d425e5c30c9348451883fc
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Improve marginalia-annotate-tab
---
 marginalia.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/marginalia.el b/marginalia.el
index c916c0e902..377ca90cfe 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -1031,9 +1031,9 @@ These annotations are skipped for remote paths."
       :truncate -0.5 :face 'marginalia-file-name))))
 
 (defun marginalia-annotate-tab (cand)
-  (when-let* ((tab (seq-find (lambda (tab)
-                               (equal (alist-get 'name tab) cand))
-                             (frame-parameter nil 'tabs)))
+  "Annotate named tab CAND with tab index, window and buffer information."
+  (when-let* ((tabs (funcall tab-bar-tabs-function))
+              (tab (seq-find (lambda (tab) (equal (alist-get 'name tab) cand)) 
tabs))
               (ws (alist-get 'ws tab))
               ;; window-state-buffers requires Emacs 27
               (bufs (and (fboundp 'window-state-buffers)
@@ -1041,12 +1041,14 @@ These annotations are skipped for remote paths."
     ;; NOTE: When the buffer key is present in the window state
     ;; it is added in front of the window buffer list and gets duplicated.
     (when (cadr (assq 'buffer ws)) (pop bufs))
-    (marginalia--fields
-     ((if (cdr bufs)
-          (format "%d windows" (length bufs))
-        "1 window ")
-      :face 'marginalia-size)
-     ((string-join bufs " ") :face 'marginalia-documentation))))
+    (concat
+     (format #(" (%s)" 0 5 (face marginalia-key)) (seq-position tabs tab #'eq))
+     (marginalia--fields
+      ((if (cdr bufs)
+           (format "%d windows" (length bufs))
+         "1 window ")
+       :face 'marginalia-size)
+      ((string-join bufs " ") :face 'marginalia-documentation)))))
 
 (defun marginalia-classify-by-command-name ()
   "Lookup category for current command."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]