emacs-diffs
[Top][All Lists]
Advanced

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

emacs-30 abefd9514bc: * lisp/tab-bar.el (tab-bar-move-tab-to-group): Fix


From: Juri Linkov
Subject: emacs-30 abefd9514bc: * lisp/tab-bar.el (tab-bar-move-tab-to-group): Fix for a new group's tab.
Date: Mon, 29 Jul 2024 14:17:28 -0400 (EDT)

branch: emacs-30
commit abefd9514bcf9d8de9d9e7f000ef55fad0d822fb
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/tab-bar.el (tab-bar-move-tab-to-group): Fix for a new group's tab.
    
    Move tab with a new group to the end of the tab bar (bug#72352)
    Suggested by Ship Mints <shipmints@gmail.com>
---
 lisp/tab-bar.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index edec6543a82..60d5bbf169b 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -2229,14 +2229,16 @@ function `tab-bar-tab-name-function'."
                 (seq-position (nthcdr beg tabs) group
                               (lambda (tb gr)
                                 (not (equal (alist-get 'group tb) gr))))))
-         (pos (when beg
-                (cond
-                 ;; Don't move tab when it's already inside group bounds
-                 ((and len (>= tab-index beg) (<= tab-index (+ beg len))) nil)
-                 ;; Move tab from the right to the group end
-                 ((and len (> tab-index (+ beg len))) (+ beg len 1))
-                 ;; Move tab from the left to the group beginning
-                 ((< tab-index beg) beg)))))
+         (pos (if beg
+                  (cond
+                   ;; Don't move tab when it's already inside group bounds
+                   ((and len (>= tab-index beg) (<= tab-index (+ beg len))) 
nil)
+                   ;; Move tab from the right to the group end
+                   ((and len (> tab-index (+ beg len))) (+ beg len 1))
+                   ;; Move tab from the left to the group beginning
+                   ((< tab-index beg) beg))
+                ;; Move tab with a new group to the end
+                -1)))
     (when pos
       (tab-bar-move-tab-to pos (1+ tab-index)))))
 



reply via email to

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