From 3be2eab2cc48bbd1332384e4024676cce2a9ff89 Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Fri, 7 Dec 2018 15:25:44 +0900 Subject: [PATCH] Fix column length --- emacs.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/emacs.el b/emacs.el index cf0d585..dd2267d 100644 --- a/emacs.el +++ b/emacs.el @@ -2193,7 +2193,18 @@ initializing." (bname (format "Git Worktree<%s>" name))) (with-current-buffer (get-buffer-create bname) (cd root) - (let ((trees (git-worktree-get-current-trees))) + (let* ((trees (git-worktree-get-current-trees)) + (branch-max-length + (apply 'max + (cl-loop for e in trees + when (plist-get e :branch) + collect (length (plist-get e :branch))))) + (worktree-max-length + (apply 'max + (cl-loop for e in trees + when (plist-get e :worktree) + collect (length (plist-get e :worktree))))) + ) (setq tabulated-list-entries (mapcar (lambda (f) (list f @@ -2202,9 +2213,9 @@ initializing." (plist-get f :head)))) trees)) (setq tabulated-list-format - `[("Refs" 30 t) - ("Worktree" 40 t) - ("Head" 0 t)]) + `[("Branch" ,branch-max-length t) + ("Worktree" ,worktree-max-length t) + ("Head" -1 t)]) (git-worktree-mode) (current-buffer)))))