Subject: bug#58866: tab-line tab order is not preserved by desktop when customizing tab-line-tabs-function

From: João Guerra <[email-masked]>
Date: Sat, 29 Oct 2022 15:06:24 +0200

desktop is restoring the tab-line tab order on application reload when
using the default tab-line-tabs-function. When using a custom
tab-line-tabs-function the order is not being preserved. (I suspect it
could be due to how I want my tabs to behave.)

Example:

(let ((old-tabs nil))
  (defun tl-tabs ()
    (let ((new-tabs (seq-filter (lambda (buffer)
                                  (or (eq buffer (current-buffer))
                                      (buffer-file-name buffer)))
                                (buffer-list))))
      (setq old-tabs (append (seq-intersection old-tabs new-tabs)
                             (seq-difference new-tabs old-tabs))))))

(setq tab-line-tabs-function #'tl-tabs)

This makes the tab-line show all file visiting buffers in all windows
+ the current window buffer, preserving their order.

Is desktop supposed to preserve the tab order for user customizations?