]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/tab-bar.el (tab-bar-move-tab-to-group): Fix for a new group's tab.
authorJuri Linkov <juri@linkov.net>
Mon, 29 Jul 2024 18:16:16 +0000 (21:16 +0300)
committerEshel Yaron <me@eshelyaron.com>
Fri, 2 Aug 2024 09:55:58 +0000 (11:55 +0200)
Move tab with a new group to the end of the tab bar (bug#72352)
Suggested by Ship Mints <shipmints@gmail.com>

(cherry picked from commit abefd9514bcf9d8de9d9e7f000ef55fad0d822fb)

lisp/tab-bar.el

index a4d40c5de7fce4bc391e48c9c51b2fe8c571021b..36a65acfdb69f4c1dc8eca57afa0702f009953d3 100644 (file)
@@ -2232,14 +2232,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)))))