Subject: bug#72352: Small tab-bar-move-tab-to-group bug fix

From: Ship Mints <[email-masked]>
Date: Mon, 29 Jul 2024 09:20:19 -0400

This corrects for the condition where a tab, among its set of tabs which
all share the same group (nil or otherwise), is changed to a new group that
doesn't yet exist. The current behavior is to leave that tab where it is
within the "old group" but this is counter to the goal of keeping
group-related tabs "together." The correction I've made is simply to move
that newly grouped tab to the end. I've tested this and been using a
patched form for a while to no ill effect.

(defun tab-bar-move-tab-to-group (&optional tab)
...

*         (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))

*                -1))) ; Move to the end*
...

Much obliged,

Stephane